#define NUMELTS 100
void main(){
int num[NUMELTS ]; /* array of numbers */
int i;
int total; /* sum of the number */
float avg; /* average of the number */
float diff; /* number and the average */
total = 0;
for(i=0; i<NUMELTS; i++){
/* read the numbers into the array and add them */
scanf("%d", num[i]);
total +=num[i];
} /* end for */
avg = (float)total/NUMELTS; /* computer the average */
printf("\nnumber difference"); /* print heading */
/ * print each number and its difference */
for(i = 0; i<NUMELTS; i++){
diff = num[i]-avg;
printf("\n%d%f", num[i], diff);
} /* end for */
printf("\naverage is : %f", avg );
} /* end main */
Learn More from Blog : void main(){
int num[NUMELTS ]; /* array of numbers */
int i;
int total; /* sum of the number */
float avg; /* average of the number */
float diff; /* number and the average */
total = 0;
for(i=0; i<NUMELTS; i++){
/* read the numbers into the array and add them */
scanf("%d", num[i]);
total +=num[i];
} /* end for */
avg = (float)total/NUMELTS; /* computer the average */
printf("\nnumber difference"); /* print heading */
/ * print each number and its difference */
for(i = 0; i<NUMELTS; i++){
diff = num[i]-avg;
printf("\n%d%f", num[i], diff);
} /* end for */
printf("\naverage is : %f", avg );
} /* end main */
Expert Web Engineering
Expert Computer Networking
Talent Programming Language C
Logical Discrete Mathematics
Expert Compiler Design
Professional Algorithm Design
Professional Responsive Web Page Design By Bootstrap
Talent Software Engineering
0 comments:
Post a Comment