C语言编程:读入一系列整数,统计出其中正整数的个数n和负整数的个数m,读入0结束。如何编?谢谢🙏

[复制链接]
查看11 | 回复2 | 2013-10-15 15:12:12 | 显示全部楼层 |阅读模式
#includemain(){int a,a1=0,a2=0;scanf("%d",&a);while(a){if(a>0)a1++;else a2++;scanf("%d",&a);}printf("%d 个数字>0,%d 个数字 int main(){
...
回复

使用道具 举报

千问 | 2013-10-15 15:12:12 | 显示全部楼层
#include "stdio.h" int main(){
intans_a = 0, ans_b = 0;
int temp;
while( scanf( "%d", &temp )&& temp != 0 )
if( temp < 0 ) ans_b++;
else ...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行