C examples for Data Type:char
Report the number of uppercase letters and the number of lowercase letters in the input.
#include <stdio.h> #include <ctype.h> int main(void) { //from www . j a v a 2 s. c o m int ch; unsigned long uct = 0; unsigned long lct = 0; unsigned long oct = 0; while ((ch = getchar()) != EOF) if (isupper(ch)) uct++; else if (islower(ch)) lct++; else oct++; printf("%lu uppercase characters read\n", uct); printf("%lu lowercase characters read\n", lct); printf("%lu other characters read\n", oct); return 0; }