count the no.of positive and negative integers
#include <stdio.h>
int main()
{
int a[6]={12,3,4,66,-88,-70};
int count=0;
int ncount=0;
for(int i=0;i<6;i++)
{
if(a[i]>=0)
{
count++;
}
else if ((a[i]<0))
{
ncount++;
}
}
printf("count:%d\n",count);
printf("%d\n",ncount);
}
Comments
Post a Comment