The user enters an integer into a text box and clicks on the Calculate button.  The application will sum all of the integers from 1 to the number entered and display the sum in a label.  The sum of numbers is the sum of all the numbers from 1 to the ending number.  For example, if the user enters 3, the sum of numbers is 1 + 2 + 3 = 6.  If the user enters 5, the sum of numbers is 1 + 2 + 3 + 4 + 5 = 15.  Your program should work for any integer entered by the user.   Use a loop to calculate the sum of numbers.  You will need to initialize the variables and assign appropriate values.  Get the value for intEndNum from the textbox.  After the loop has run, display intSum in the label. Here is one way to code the loop:           For intCount = 1 To intEndNum               intSum = intSum + intCount          Next   Calculate Button Click-Event Procedure You may find following these steps helpful: Declare three variables intEndnum              Ending number provided by the user intCount                  Loop counter intSum                     Running total Get the ending number from the user. Assign the text property of your textbox to intEndNum Code the loop. A sample is given above. Display the running total. Assign intSum to the text property of your label.

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter5: The Repetition Structure
Section: Chapter Questions
Problem 15E
icon
Related questions
Question

Microsoft Visual Studio Softare.

The user enters an integer into a text box and clicks on the Calculate button.  The application will sum all of the integers from 1 to the number entered and display the sum in a label. 

The sum of numbers is the sum of all the numbers from 1 to the ending number.  For example, if the user enters 3, the sum of numbers is 1 + 2 + 3 = 6.  If the user enters 5, the sum of numbers is 1 + 2 + 3 + 4 + 5 = 15.  Your program should work for any integer entered by the user.

 

Use a loop to calculate the sum of numbers.  You will need to initialize the variables and assign appropriate values.  Get the value for intEndNum from the textbox.  After the loop has run, display intSum in the label.

Here is one way to code the loop:

          For intCount = 1 To intEndNum
              intSum = intSum + intCount
         Next

 

Calculate Button Click-Event Procedure

You may find following these steps helpful:

  1. Declare three variables
    intEndnum              Ending number provided by the user
    intCount                  Loop counter
    intSum                     Running total
  2. Get the ending number from the user. Assign the text property of your textbox to intEndNum

  3. Code the loop. A sample is given above.

  4. Display the running total. Assign intSum to the text property of your label.
Sum of Numbers
DIRECTIONS:
Enter an integer for the Ending Number in the text box
below and click on the Calculate button. The sum of
numbers 1 through the number that you entered will
be calculated and displayed.
Ending Number:
Sum of Numbers:
Calculate
X
Exit
Transcribed Image Text:Sum of Numbers DIRECTIONS: Enter an integer for the Ending Number in the text box below and click on the Calculate button. The sum of numbers 1 through the number that you entered will be calculated and displayed. Ending Number: Sum of Numbers: Calculate X Exit
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage