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.
32 lines
670 B
32 lines
670 B
#include <stdio.h>
|
|
void fun(char *s,int *a,int *b,int *c,int *d,int *e)
|
|
{
|
|
int i=0,j=0,k=0,l=0,m=0;
|
|
while(*s){
|
|
if(*s>='A'&&*s<='Z')
|
|
i++;
|
|
else if(*s>='a'&&*s<='z')
|
|
j++;
|
|
else if(*s>='0'&&*s<='9')
|
|
k++;
|
|
else if(*s==' ')
|
|
l++;
|
|
else
|
|
m++;
|
|
*s++;
|
|
}
|
|
*a=i;
|
|
*b=j;
|
|
*c=k;
|
|
*d=l;
|
|
*e=m;
|
|
}
|
|
int main( )
|
|
{
|
|
char s[100];
|
|
int upper=0,lower=0,digit=0,blank=0,other=0;
|
|
gets(s);
|
|
fun (s,&upper,&lower,&digit,&blank,&other);
|
|
printf("upper=%d\nlower=%d\ndigit=%d\nblank=%d\nother=%d\n",upper,lower,digit,blank,other);
|
|
return 0;
|
|
} |