C programs to Count Positive, Zero, and Negative Numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
 clrscr();
 int countp=0, countn=0, countz=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)
  {
   countn++;
  }
  else if(arr[i]==0)
  {
   countz++;
  }
  else
  {
   countp++;
  }
 }
 printf("Positive Numbers = %d\n",countp);
 printf("Negative Numbers = %d\n",countn);
 printf("Zero = %d",countz);
 getch();
}
C programs to Count Positive, Zero, and Negative Numbers. C programs to Count Positive, Zero, and Negative Numbers. Reviewed by on December 22, 2019 Rating: 5

No comments:

Powered by Blogger.