×

# C program to calculate sum and average of an array

Help of this post we are learning how to calculate sum and average of an given array. Suppose given contain following element.

Time complexity of this program O(n)

Below in C implementation of this problem. Iterative approach.

## Accepted Output

Data of Array is: 34, 21, 5, 52, 32, 12, 42, 12, 323, 33, 12, 344, 23

Sum of array is : [945]

Average of array is: [72]

Data of Array is: 23, 5, 21, 51, 111, 34, 12, 121, 44, 22, 113, 112

Sum of array is : [945]

Average of array is: [72]

Output

Data of Array is: 23 5 21 51 111 34 12 121 44 22 113 112 Sum of array is : [669] Average of array is: [55]

View comments and participate Discussion