Calculate the average of an array {15, 22, 8, 10, 35}.
MediumProblem Statement
Calculate the average of an array {15, 22, 8, 10, 35}.
Sample Input
15 22 8 10 35
Sample Output
Average: 18.00
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
#include <stdio.h>
float calculateAverage(int arr[], int n) {
// Your code here
}
int main() {
int arr[] = {15, 22, 8, 10, 35};
printf("Average: %.2f\n", calculateAverage(arr, 5));
return 0;
}
Input
15 22 8 10 35
Expected Output
Average: 18.00