COUNT NUMBERS GREATER THAN ZERO LESS THAN ZERO EQUAL TO ZERO

/*PROGRAM TO COUNT NUMBERS GREATER THAN ZERO, LESS THAN ZERO, EQUAL TO ZERO*/
#include<stdio.h>
#include<conio.h>
void main()
{
int a[12],g=0,e=0,l=0,i;
clrscr();
printf(“Enter any ten numbers: “);
for(i=0;i<10;i++)
scanf(“%d”,&a[i]);
printf(“Entered numbers are: “);
for(i=0;i<10;i++)
printf(“%d\t”,a[i]);
for(i=0;i<10;i++)
{
if(a[i]>0)
g=g+1;
else if(a[i]==0)
e=e+1;
else
l=l+1;
}
printf(“\n”);
printf(“\n\t%d numbers are greater than zero”,g);
printf(“\n\t%d numbers are equal to zero”,e);
printf(“\n\t%d numbers are less than zero”,l);
getch();
}

Leave a Reply

Your email address will not be published. Required fields are marked *