/*
============================================================================
Name : C-Programming
Author : Code2care
Version : 1.0
Copyright : Code2care.org
Description : 94 : Print number of Uppercase and Lowercase and other characters in a String
============================================================================
*/
#include
#include
int main(void) {
char ch;
int upper = 0;
int lower = 0;
int others = 0;
printf("Enter any sentence : ");
while ((ch = getchar()) != '\n') {
if (ch >= 'A' && ch <= 'Z') {
upper = upper + 1;
} else if (ch >= 'a' && ch <= 'z') {
lower = lower + 1;
} else {
others = others + 1;
}
}
printf("\nUppercase Characters : %d", upper);
printf("\nLowercase Characters : %d", lower);
printf("\nOthers : %d", others);
return 0;
}
-
Output :
Enter any sentence : 1000 C Programming Tutorials
Uppercase Characters : 3
Lowercase Characters : 18
Others : 7
Enter any sentence : Learn PHP, JSON, Swift, C Programming, Java, Android Programming, SQLite and much more on Code2care.org
Uppercase Characters : 18
Lowercase Characters : 63
Others : 22
The best way to learn C programming is to practice more and more of programs .
Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.
BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.