输入一串字符,统计其中正数、负数、0的个数并在屏幕上显示

如题所述

#include <Stdio.h>
main()
{
int max,positive=0,negative=0;
int num;

scanf("%d",&num);
max=num;
while(num!=0)
{
if(num>0) positive++;
else if(num<0) negative++;
if(max<num) max=num;
scanf("%d",&num);
}
printf("最大的数是:%d\n",max);
printf("正数个数:%d\n负数个数:%d\n",positive,negative);
}
温馨提示:内容为网友见解,仅供参考
第1个回答  2011-06-23
用C语言编程序吗?追问

用汇编语言

追答

抱歉啊~~我不会汇编

相似回答
大家正在搜