Write and Read Data File -> Calculate Average

Write a program that creates a text file named "data_avg.txt" that contains between 3 and 10 random integers, then have your program read in those integers and output the integers, the sum, and the average in the format shown below.

# note the word 'and' in the first line and the periods at the end of all lines.

The integers in data_avg.txt are 1 2 and 4.

The sum of the integers is 7.

The average is 2.3.

[ Teacher solution ]