Write a program in C to calculate sum and average of ten real numbers stored in float array?
Answers
Answered by
2
#include<stdio.h>
int main()
{ int i;
float arr[10], sum, avg;
sum=avg=0.0;
for(i=0;i<10;i++)
{ scanf("%f", &arr[i]);
sum+=arr[i];
}
avg=sum/10;
printf("%f", sum);
printf("%f", avg);
}
Answered by
0
"From the given question, ten real numbers should be summed up and then its average must be calculated in float variable.
Img 30_11
By running this program the sum and average of ten numbers can be calculated.
Usually real numbers are denoted as integers in calculations and rational numbers are given in float variable.
Characterising the real numbers as float variable does not going to change any result, we will get same result in the output. "
Attachments:

Similar questions
Math,
8 months ago
Accountancy,
8 months ago
Computer Science,
1 year ago
Math,
1 year ago
Math,
1 year ago