/* Program for counting the number of uppercase, lowercase, digit and blank characters in a given statement */ main() { int i=0,u=0,l=0,d=0,b=0,s=0; char str[80]; clrscr(); printf("\n\n\t\tThis program will help you to count the number of "); printf("\n\t\t characters in a given sentence."); printf("\n\n\t\tEnter the string in front of '->' prompt : \n -> "); gets(str); while(str[i]!='\0') { if((str[i]>='A')&&(str[i]<='Z')) u++; else { if((str[i]>='a')&&(str[i]<='z')) l++; else { if((str[i]>='0')&&(str[i]<='9')) d++; else { if(str[i]==' ') b++; else s++; } } } i++; } printf("\n\n\t\t\t\t - A N S W E R -"); printf("\n\t\tYour string consists of :\n\n\t\t%d Uppercase characters\n\t\t%d Lowercase characters\n\t\t%d Digit characters\n\t\t%d Blank Spaces\n\t\t%d Special Symbols",u,l,d,b,s); printf("\n\n\t\t\t\t- STATISTICS OVER -"); getch(); }