Write a program using a for loop that creates a file and adds odd numbers that are in the integers 1 through 20 to the file. Name the file as numbers.txt. Then perform the following on the file: Read all of the numbers stored in the file and calculate their total. Display all the numbers in the file and the calculated total Using a for loop add the following numbers to the file 21 through 30 Delete the following numbers from the file 24, 25, 26   (using a temp.txt file) Change the number 11 to 50 (using a temp.txt file)

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question
  1. Write a program using a for loop that creates a file and adds odd numbers that are in the integers 1 through 20 to the file. Name the file as numbers.txt. Then perform the following on the file:
  2. Read all of the numbers stored in the file and calculate their total.
  3. Display all the numbers in the file and the calculated total
  4. Using a for loop add the following numbers to the file 21 through 30
  5. Delete the following numbers from the file 24, 25, 26   (using a temp.txt file)
  6. Change the number 11 to 50 (using a temp.txt file)
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning