218k views
14 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 Eric Mabo
by
4.5k points

1 Answer

7 votes

Answer: int sum = 1, n;

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

cout<<sum;

Step-by-step explanation:

User Trakos
by
5.0k points