98 947
Assignments Done
98.8%
Successfully Done
In May 2021

# Answer to Question #27097 in Programming & Computer Science for victor

Question #27097
this is in pseudocode

Write a program using loops, conditionals, and file processing concepts. Write a main module, two subprograms, and one function based on an array input by the user.

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.
1
2013-04-08T08:22:32-0400
procedure input_arr(file_name, a[])
{
i = 0;
do {
i = i + 1;
} while (a[i] != 0)
close_file(file);
}

function mean(a[]) {
sum = 0;
i = 0;
while (a[i] != 0) {
sum = sum + a[i];
i = i + 1;
}
return sum / i;
}

procedure output_num(file_name, number)
{
file = open_file_for_writing(file_name);
write_to_file(file, number);
close_file(file);
}

main()
{
a[] = empty_arr();
input_arr(&quot;input.txt&quot;, a);
output_num(&quot;output.txt&quot;, mean(a));
exit();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!