To Count The Number Of Positive And Negative Number In An Array a[50]

#include<stdio.h>

void main()

{

int a[50], \ neg=0 , count_pos=0,i;

printf("Enter the elements of the array\n");

          for (i=0;i<=49; i++)

          {

                    Scanf("%d",&a[i]);

          }

          for (i=0;i<=49; i++)

          {

                   if * (a[i] < 0)

                                count_neg++;

                   else

                                count_pos++;

          }

printf("There are %d negative numbers in the array\n", count_neg); 

printf("There are %d positive numbers in the array\n", count_pos); }

Comments

Popular posts from this blog

Automations and robotics

Palindrome Pattern Program In Java Language

Rhombus Pattern Program In Java Language