Question: Write a program to read-in a sequence of integers from the keyboard using scanf) and write out those integers into a file called out.txt one-value-per-line.

 Write a program to read-in a sequence of integers from the

Write a program to read-in a sequence of integers from the keyboard using scanf) and write out those integers into a file called "out.txt" one-value-per-line. Your program will begin by opening an output file called "out.txt" in the same directory from which your program is ru se a while) loop to read integers from the keyboard until the user enters ctrl-Z (EOF) from the keyboard. When scanf) reads-in a valid integer, it will return the value +1. When scanf) tries to read-in ctrl-z (EOF), it will return a value of- ndicating that it did not read-in a valid integer from the keyboard Use the return value from scanf) in the logic expression for the while) loop, to exit the loop when the user enters ctrl-z. Keep a tally of the number of integers entered from the keyboard, and keep a running sum of those integers. Print the number of integers entered by the user and their sum into the bottom line of the output file "out.txt" using a properly worded message, such as "The 12 integers entered in this file sum to 1043.". Close the output file. Print the same message e.g. "The 12 integers entered in this file sum to 1043." to the screen

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!