Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm stuck on the problem. They gave us a sample program that calculates the sum of the numbers entered by the user and using that

I'm stuck on the problem. They gave us a sample program that calculates the sum of the numbers entered by the user and using that we are supposed to creat anew program that then calculates the average. I will also put my code down so you can see where I am. (Language c)

image text in transcribed

image text in transcribedimage text in transcribed

File: average.c 00 VOU AWN This program reads in a list of integers until the user enters the value -1 as sentinal. At that point, the program should display the average of the values entered so far. 9 10 11 12 13 #include #include "genlib.h" #include "simpio.h" 14 main() 15 16 17 int value, total, average, i; 18 20 21 22 23 printf('This program averages a list of integers. '); printf("Enter -1 to signal the end of the list. ') total = 0; i = 0; while (i #include "genlib.h" #include "simpio.h" main() int value, total; printf("This program adds a list of numbers. In printf("Signal end of list with a on total = 0; while (TRUE) printf("? "); value = Get Integer (), if (value == 0) break; total += value; printf("The total is din total)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions