Close or Esc Key

Arduino Projects   |   Raspberry Pi   |   Electronic Circuits   |   AVR   |   PIC   |   8051   |   Electronic Projects

Count the total negative, positive and zero from a set of Integers

/* C Program: Read set of integer numbers and count
   the total negative, Positive and zero  */
void main()
   int x, n_count=0, p_count=0,z_count=0,i=0;
   char ch;
      printf("\nEnter an integer number -> ",++i);
      if(x<0) n_count++;
      else if(x>0) p_count++;
  else z_count++;
      printf("\n\n\nAny more number <<y/>> ? ");
   printf("Total Negative Number : %d\n",n_count);
   printf("Total Positive number : %d\n",p_count);
   printf("Total Zero            : %d\n",z_count);