/*EXPERIMENT : */ /* PROGRAMMER : SHEKHAR A. SHERIKAR */ /* AIM : TO COUNT THE NUMBER OF UPPERCASE & LOWERCASE ALPHABETS, DIGITS, BLANKS AND SPECIAL SYMBOLS IN A GIVEN SENTENCE */ 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 "); printf("\n\t\t of characters in a given sentence."); printf("\n\n\t\t Enter the string in front of '->' prompt : \n\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\n\t\t\t Your string consists of :"); printf("\n\n\t\t\t %d Uppercase Characters",u); printf("\n\t\t\t %d Lowercase Characters",l); printf("\n\t\t\t %d Digit Characters",d); printf("\n\t\t\t %d Special Symbols",s); printf("\n\t\t\t %d Blank Spaces",b); printf("\n\n\t\t\t\t- STATISTICS OVER -"); getch(); }