Question: Problem 4 Write a complete C++ program that does the following. 1. It asks the user to enter a positive integer. 2. The program reads
Problem 4 Write a complete C++ program that does the following.
1. It asks the user to enter a positive integer.
2. The program reads a value n entered by the user. If the value is not legal, the program terminates.
3. The program prints a table with n lines of output. On output line number x the program should list the numbers from 1 to x together with their sum.
Example, if the user enters 7 for n the program should print the following table.
1 the sum is 1
1 2 the sum is 3
1 2 3 the sum is 6
1 2 3 4 the sum is 10
1 2 3 4 5 the sum is 15
1 2 3 4 5 6 the sum is 21
1 2 3 4 5 6 7 the sum is 28
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
