Total Number of positives, negetives and zeros from entered number - C - A4P9



/* Write a program to find the total number of negative,
   positive and zero from entered number */

#include<stdio.h>
#include<conio.h>
void main()
{
    int a,arr[10],pos=0,neg=0,ze=0;
    clrscr();
    for(a=0;a<10;a++)
    {
        printf("Enter Element [%d] -> ",a);
        scanf("%d",&arr[a]);
        if(arr[a]<0)
        {
            neg++;
        }
        else if(arr[a]>0)
        {
            pos++;
        }
        else
        {
            ze++;
        }
    }
    printf("\n\nTotal Positive Elements   -> %d",pos);
    printf("\nTotal Negative Elements   -> %d",neg);
    printf("\nTotal Zero value Elements -> %d",ze);
    getch();
}

Post a Comment