/*C Program to find deviation from average of a given data*/
#include<stdio.h>
#include<math.h>
void main() {
int temp[7], i, sum = 0, av;
float dev;
printf("\nEnter the seven days temperature:\n");
for (i = 0; i < 7; i++) {
scanf("%d", &temp[i]);
sum += temp[i];
}
av = sum / 7;
for (i = 0; i < 7; i++) {
dev = av - temp[i];
dev = fabs(dev);
printf("deviation= %3.1f\n", fabs(dev));
}
}
WHAT'S NEW?
Loading...
0 comments:
Post a Comment