Question: Combine the statements that you wrote in Exercise 5.5 into a C# app that calculates and displays the sum of the integers from 1 to
Combine the statements that you wrote in Exercise 5.5 into a C# app that calculates and displays the sum of the integers from 1 to 10. Use a while statement to loop through the calculation and increment statements. The loop should terminate when the value of x becomes 11.
Data From Problem 5.5
Write a C# statement to accomplish each of the following tasks:
a) Declare the int variable sum and initialize it to 0.
b) Declare the int variable x and initialize it to 1.
c) Add variable x to variable sum, and assign the result to variable sum.
d) Display "The sum is: ", followed by the value of variable sum.
Step by Step Solution
3.40 Rating (162 Votes )
There are 3 Steps involved in it
The app is as follows The sum is 55 I 2 3 4 5 67890123456 10 6 12 13 14 16 17 18 19 ... View full answer
Get step-by-step solutions from verified subject matter experts
