Starting Vocational Training From 1-May-2024 Get Detail


Write a program in C to read 10 numbers from keyboard and find their sum and average. 
Test Data :
Input the 10 numbers : 
Number-1 :2 
... 
Number-10 :2 
Expected Output : 
The sum of 10 no is : 55 
The Average is : 5.500000


#include <stdio.h>
void main()
{       
    int i,n,sum=0;
    float avg;
    printf("Input the 10 numbers : ");
    for (i=1;i<=10;i++)
    {
                printf("Number-%d :",i);

        scanf("%d",&n);
        sum +=n;
    }
    avg=sum/10.0;
    printf("The sum of 10 no is : %d The Average is : %f ",sum,avg);
 
}