#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int countpos=0, countneg=0, countzero=0, arr[10], i;
printf("Enter 10 numbers : ");
for(i=0; i<10; i++)
{
scanf("%d",&arr[i]);
}
for(i=0; i<10; i++)
{
if(arr[i]<0)
{
countneg++;
}
else if(arr[i]==0)
{
countzero++;
}
else
{
countpos++;
}
}
printf("Positive Numbers = %d\n",countpos);
printf("Negative Numbers = %d\n",countneg);
printf("Zero = %d",countzero);
getch();
}
Run 1:
Run 2:
Previous Next
No comments:
Post a Comment