195,729 views
0 votes
0 votes
design the logic for a program that allows a user to enter a number. display the sum of every number from 1 through the entered number

User Barnes
by
3.4k points

1 Answer

27 votes
27 votes

Answer: int sum = 1, n;

do {cin>>n; sum+=n;}while (n!=0);

cout<<sum;

Step-by-step explanation:

User Keryruo
by
3.3k points