/* 14(a) W.A.P. to accept 10 integers (+ve, -ve and 0), find the sum of +ve and -ve numbers and also calculate the average and display all the integers above and below average. */

#include<stdio.h>
void main()
{
    /* Variable Declarations */
    int i,num[9],sump=0,sumn=0,navg=0,naavg=0,nbavg=0;
    float avg;
    clrscr();
    printf("Input 10 integers (+ve, -ve & Zero) :\n");
    /* Calculate Sum of +ve & -ve numbers in the list */
    for (i=0; i<=9; i++)
    {
        printf("Number %d = ",i+1);
        scanf("%d",&num[i]);
        if (num[i]<0) sumn+=num[i];
        else sump+=num[i];
    }
    printf("\n\nSum of +ve numbers = %d",sump);
    printf("\nSum of -ve numbers = %d",sumn);
    avg=(sump+sumn)/10.0;
    printf("\nAverage of 10 numbers = %.2f",avg);
    /* Check the Nos. above & below average & also average of all Nos. */
    for (i=0; i<=9; i++)
    {
        if (num[i]<avg) nbavg++;
        else if(num[i]==avg) navg++;
        else naavg++;
    }
    printf("\n\nNumbers above average = %d",naavg);
    printf("\nNumbers below average = %d",nbavg);    
    printf("\nNumbers equals average = %d",navg);    
    getch();
}