Combine the statements that you wrote in Exercise 5.5 into a C# app that calculates and displays

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Visual C# How to Program

ISBN: 978-0134601540

6th edition

Authors: Paul J. Deitel, Harvey Deitel

Question Posted: