## Problem 2.6 :: Write program to count and print the number of negative and positive numbers in a given set of numbers. Test your program with a suitable set of numbers. Use scanf to read the numbers. Reading should be terminated when the value 0 is encountered.


## Solution ::

## Write down headers yourself.

void main()
{
int a,b=0,c=0;
clrscr();
printf("\nInput positive & negative :");
printf("\nInput 0 to stop");
for(a=0;a<=1000;a++)
{
scanf("%d",&a);
if(a==0)
break;
if(a<0)
b++;
if(a>0)
c++;
}
printf("\nNegative item=%d",b);
printf("\nPositive item=%d",c);
getch();
}

0 comments