用C语言编写一个程序
用C语言编写一个程序:从键盘输入若干个字符,分别统计其中字母符号(区别大。小),数字字符和其他字符的
#include #include void main() { int i=0,n=0,m=0,j=0,k=0; char str[100]; printf("please input one string.\n"); scanf("%s",str); printf("\n"); while(str[i]!='\0') { if(str[i]>='a'&&str[i]='A'&&str[i]='0'&&str[i]<='9')j++; else k++; i++; } printf("小写字母:%d\n",n); printf("大写字母:%d\n",m); printf("数字:%d\n",j); printf("其他:%d\n",k); }
楼上的scanf("%s",str);函数是以空格或回车为中止符的,建议换个
问:C语言 编写程序 求1-3+5-7+。。。-99+101的值
答:#include"stdio.h" main() { int i,s=0,f=1; for (i=1;i<=101;i+=2) { s=s+i*f; f=-f;...详情>>