Problem Description
Calculate average of n numbersCODING ARENA
#include<stdio.h>
int main()
{
int a,b[100],c=0,i;
scanf("%d",&a);
for(i=0;i<a;i++)
{
scanf("%d",&b[i]);
c=c+b[i];
}
printf("%d",c/a);
return 0;
}
Test Case 1
Input (stdin)5 1 2 3 4 5
Expected Output3
Test Case 2
Input (stdin)3 1 2 3
Expected Output2
No comments:
Post a Comment