/ * Enter the number of non-integer 0, 0 stops until the input required number of integer input of up to more than 20 the number of statistics the number of positive numbers, negative * / seek the guidance of the great God, why can not the results

/ * Number of non-input integer 0, stop until the input 0, the integer input required
maximum number of no more than 20, statistics on the number of positive, negative number * /
#include <stdio.h>
int main ()
{
    int A [20 is], I, n-= 0, C = 0, B = 0;
    the while (! (getchar ()) = '0')
    
    for (I = 0; I <20 is; I ++)
    {
        Scanf ( " % D ", & A [I]);
        n-= n-+. 1;
        IF (A [I] == 0)
        BREAK;    
    }
    
    for (I = 0; I <n-; I ++)
    {
        IF (A [I]> 0 )
            C = C +. 1;
        IF (A [I] <0)
            B = B +. 1;
    }

    printf("posn=%d,negn=%d\n",c,b);
    return 0;
    
 } 

发布了1 篇原创文章 · 获赞 0 · 访问量 61

Guess you like

Origin blog.csdn.net/weixin_46104946/article/details/104594578