void main()
{
char ch
int num1,num2,num3,num4,m
num1=0
num2=0
num3=0
num4=0
puts("Type in a sentence,then press <ENTER>\n")
while ((ch=getchar())!='\n')
{
if(ch>=48&&ch<=57) num1++
else if(ch>=65&&ch<凳行念=90) num2++
else if(ch>=97&&ch<=122) num3++
else num4++
}
printf("%4d%4d%4d%4d",num1,num2,num3,num4)
}
帮你改枣困了一下带和 你的太复杂了 可以运行
#include <stdio.h>#include <conio.h>
void main()
{
clrscr()
int n=1,i=0,j=0,plus=0,negative=0
while(n!=0)
{
scanf("%d",&n)
if(n>0)
{
plus=plus+n
i++
}
else if(n<0)
{
negative=negative+n
j++
}
else
{
printf("里面正数的和是%d,个数纳模悔是%d\n",plus,i)
printf("里面负数的和是%d,个数是%d\n",negative,j)
}
}
getch()
}
同学
我是在turbo c 3.0 中运码咐行成功的
我知道合洞正不合你的心意
我们大家都是初学者
希望能够一起在C语言上取得成功
#include "stdio.h"void main()
{int sum=0,p,i=0
while(1)
{ scanf("%d"租洞缓轿,&p)
sum=sum+p
i++
if(i==10) break}
printf("sum=%d",sum)
getch()
}
在这个弊哪枯程序你的n=10,你自己修改
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)