Question: C language: Please correct this program. This program calculate the avg of the numbers given to it as input. You should terminate the input with

C language: Please correct this program. This program calculate the avg of the numbers given to it as input. You should terminate the input with the end-of-file character.

 C language: Please correct this program. This program calculate the avg

This is what I have now, however, when I try to run the program, it only promts me to input values, once I enter the values and enter into the while loop, it prints out the avg value and keep prompting user for input and keep looping. I cant exit the file with control D but only with control c. (btw I never changed any of my shortcut keys) Thanks in advance!!!!

#include int main() int value; int x,y,z; int stop; float avg; /*Get the inputs printf("enter the value: ", x); scanf( "%d" ,&x) ; printf("enter the value: ", y); scanf("%d" ,&y); printf("enter the value: ", z); scanf(1%d",&z) ; /* While there is more input while stop !EOF) k/ / calculate the average avg - (x+y+z)/3.0; /Get the next set of inputs printf("The avg now is %f. ", avg); printf("Enter a number(use command of EOF to exit): ",x); scanf("96d",&x) ; printf("Enter a number(use command of EOF to exit):In ",y) scanf("%d",&y); printf("Enter a number(use command of EOF to exit):In ",z) scanf("%d", &z) / Print the results printf("The avg 1s %f. " , avg)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!