发布网友 发布时间:2024-10-23 21:32
共2个回答
热心网友 时间:2024-10-27 05:14
#include "stdio.h"
main()
{char c,sum1=0,sum2=0,number=0;
c=getchar();
while(c!='#')
{
if(c>='A'&&c<='Z') sum1++;
else if(c>='a'&&c<='z') sum2++;
else if(c>='0'&&c<='9') number++;
c=getchar();
}
printf("大写字母:%d,小写字母:%d,数字:%d",sum1,sum2,number);
}
热心网友 时间:2024-10-27 05:13
#include<stdio.h>
main()
{
int count_Lowcase,count_Highcase,count_Number;
int i,j,c;
char str[256];
scanf("%s",str);
count_Lowcase= count_Highcase = count_Number = 0;
i=1;
c = 0;
while( str[c] && str[c] != '#' )
{
if(str[c]>='0' && str[c]<='9')
{
++count_Number ;
}
else if(str[c]>='a' && str[c]<='z' )
{
++count_Lowcase;
}
else if(str[c]>='A' && str[c]<='Z' )
{
++count_Highcase ;
}
++c;
}
printf("Lowercase:%d\n",count_Lowcase);
printf("Uppercase:%d\n",count_Highcase );
printf("Number:%d\n",count_Number);
}