Programming Examples

C program to input 10 number in array and find its sum and average


Write a C program to input 10 integer number in array and find its sum and average.

Solution

#include<stdio.h>
int main()
{
	int a[10],i,x,sum=0;
	float avg;
	printf("\nEnter the 10 element\n");
	for(i=1;i<=10;i++)
	{
		scanf("%d",&a[x]);
		sum=sum+a[x];
	}
	avg=(float)sum/10;
	printf("sum=%d\n average=%f",sum,avg);
	return 0;
}
Output

Enter the 10 element

3

4

5

5

6

6

4

3

3

2

sum=41

average=4.100000

Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad