C语言 判断字母大小写编程,先输入n,再输入n个实数并分别统计正数的和、负数的和、然后输出统计结果。

来源:百度知道 编辑:UC知道 时间:2024/05/21 21:03:46
C语言 判断字母大小写编程,先输入n,再输入n个实数并分别统计正数的和、负数的和、然后输出统计结果。
谢谢你~这个问题完成了~
但我还有个问题,给你个传送门
http://zhidao.baidu.com/question/79781881.html

我用的是整数,如果要用到小数,你可以定义各处变量为float,输入和输出时把%d改成%f就可以了。
#include "stdio.h"
void main()
{
int n=0,temp=0,sumplus=0,sumnegative=0;
printf("please input n\n");
scanf("%d",&n);
while(n>0)
{
scanf("%d",&temp);
if(temp>=0) //0 is treated as plus;
sumplus+=temp;
else
sumnegative+=temp;
n--;
}
printf("the sum of plus number is %d\n",sumplus);
printf("the sum of negative is %d\n",sumnegative);
}

这个,和字母大小写有啥关系呢????