Write a program that asks the user to input one number at a time and then the program should add the number to previous sum. If the user enters -1, then no more addition is to be done. All these numbers along with the sum value are to be stored in the file.Once this is done, user will enter value of n, the program should be able to display which was the nth number entered and what was the sum at that time?
Write a program that asks the user to input one number at a time and then the program should add the number to previous sum. If the user enters -1, then no more addition is to be done. All these numbers along with the sum value are to be stored in the file.Once this is done, user will enter value of n, the program should be able to display which was the nth number entered and what was the sum at that time?
Chapter13: File Input And Output
Section: Chapter Questions
Problem 6PE
Related questions
Question
100%
Write a program that asks the user to input one number at a time and then the program should add the number to previous sum. If the user enters -1, then no more addition is to be done. All these numbers along with the sum value are to be stored in the file.Once this is done, user will enter value of n, the program should be able to display which was the nth number entered and what was the sum at that time?
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
Knowledge Booster
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.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning