Need to know if I have it right or not in the program please . Input a list of positive numbers (terminated by 0) into an array, find the mean (average) of the numbers in the array, and output the result. Use a subprogram to input the numbers, a function to find the mean, and a sub- program to output the result.
MAIN
Declare Numbers [100] As string
Declare Average As Integer
Declare Count1 As Float
Call Input_Subprogram
Call Function Model
Call Output_Subprogram
END Program
Subprogram Input Model
Write “Enter a positive number.”
Write “Enter *,0 when done.”
Input Number[count1]
While Number != 0
Set Count1 = Count1 + 1
Write “Enter another positive number (enter *,0 when done)”
Input Number
End While
End Subprogram Input Model
Call Function Module
Set Average = (Number[count1] + number[count1] +1) / number[Count1]+1
End Call Function Module
Subprogram Output Data Module
Write “The Average is:” , Average
End Subprogram Output Data Module
3 answers
well, did you actually try running it?
Not sure how do that but just write it out.
A car taken an average of 3 hours to reach a distance of 280 kilometers write a C program that will input a distance in meters and output how much time it will reach its destination?