Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Plz write codes in C In Class Code o Create a program called average-w-input.c w

ID: 3711549 • Letter: P

Question

Plz write codes in C

In Class Code o Create a program called average-w-input.c which asks the user for how many numbers they want to use and then accepts those numbers. Finally, take their average and then print the average to the screen If you finish this in class, you can show it to the instructor or student assistant. Enter how many numbers you want to process: 4 Enter number: 22 Enter number: 33 Enter number: 44 Enter numbe: 55 If you are unable to complete this during class, copy and paste your code and save it as a.c file which you can upload. To save your file, you can click the blue download button in onlinegdb.com Your file will be saved as main.c, you can rename it. The average ot theubes is 38.5

Explanation / Answer

#include <stdio.h>

int main()
{
int n,i,value;
int sum = 0;
double avg = 0;
printf("Enter how many numbers you want to process: ");
scanf("%d", &n);
for(i=0;i<n;i++) {
printf("Enter number: ");
scanf("%d", &value);
sum=sum+value;
}
printf("The average of the %d numbers is %.2f",n,sum/(double)n);

return 0;
}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote