AR13
QUESTION DESCRIPTION
Saravanan decided to play a game and he prepared a technical question for the new game.
Now he announced the question to calculate the mean of the elements of the array.
Mandatory function name should be declared as "float findMean(int A[], int N)"
Saravanan decided to play a game and he prepared a technical question for the new game.
Now he announced the question to calculate the mean of the elements of the array.
Mandatory function name should be declared as "float findMean(int A[], int N)"
TEST CASE 2
INPUT
INPUT
6
1 2 5 41 23 1
OUTPUT12.17
#include <stdio.h>
float findMean(int A[], int N)
{
float m,sum=0;
int j;
for(j=0;j<N;j++)
{
sum=sum+A[j];
}
m=sum/N;
printf("%.2f",m);
}
int main() {
int n;
scanf("%d",&n);
int a[n],i;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
findMean(a,n);
return 0;
}
Comments
Post a Comment