array notes with programmes in c

Solutions on MaxInterview for array notes with programmes in c by the best coders in the world

showing results for - "array notes with programmes in c"
Claudio
02 Mar 2018
1// Program to find the average of n numbers using arrays
2
3#include <stdio.h>
4int main()
5{
6     int marks[10], i, n, sum = 0, average;
7
8     printf("Enter number of elements: ");
9     scanf("%d", &n);
10
11     for(i=0; i<n; ++i)
12     {
13          printf("Enter number%d: ",i+1);
14          scanf("%d", &marks[i]);
15          
16          // adding integers entered by the user to the sum variable
17          sum += marks[i];
18     }
19
20     average = sum/n;
21     printf("Average = %d", average);
22
23     return 0;
24}
25