You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
593 B

#include <stdio.h>
#include <string.h>
int main()
{
char str[100];
int n, a = 0, b = 0, c = 0, d = 0, e = 0;
gets(str);
n = strlen(str);
for(int i = 0; i < n; i ++)
{
if(str[i] >='A' && str[i] <= 'Z')
a ++;
else if(str[i] >= 'a' && str[i] <= 'z')
b ++;
else if(str[i] >= '0' && str[i] <= '9')
c ++;
else if(str[i] == ' ')
d ++;
else
e ++;
}
printf("capital letters:%d\nsmall letters:%d\nblank spaces:%d\nnumbers:%d\nother:%d", a, b, d, c, e);
return 0;
}