Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program that opens a text file called numbers.txt for reading. The file contains a sequence of integers all separated by new lines.

Write a C program that opens a text file called numbers.txt for reading. The file contains a sequence of integers all separated by new lines. Your program should read all of the numbers in the file and output the following information: A count of the number of integers read. The sum of all the integers in the file. The smallest integer in the file. The largest integer in the file. The average of all the numbers.

I ran the program with the following input file.

7

4

3

5

-20

1

9

87

32

41

9001

File location: To test your program, you can use an absolute path (full path) for the text file like what I had in the class. When you submit your program, just use ?numbers.txt? (remove any path information) in fopen function. If you know the location of your executable program, you can copy the numbers.txt file to that directory. Your program output should look something like the following:

is 9170. There were 11, integers in the file. The sum of all the integers in, the fi The smallest integer in the file is The largest integer in the file is 2001 The average of the numbers 13 833.636364. all is Press any key to continue.

Step by Step Solution

3.45 Rating (148 Votes )

There are 3 Steps involved in it

Step: 1

include int main FILE fp int numisumminmax double a... blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Programming questions

Question

Review the history of forensic psychology in the United States.

Answered: 1 week ago

Question

1 point What protocol is used to send an email? DNS HTTP POP 3 SMTP

Answered: 1 week ago