Assignment No. 5

Loops

Sum of Numbers

 

Sum of Numbers form                              Sum of Numbers message box

 

Sum of Numbers input box

 

Create an application that displays a form similar to the one shown.

When the Enter Numbers button is clicked, the application should display the input box shown. 

The input box asks the user to enter a positive integer value.  The default value should be 10.  When the OK button clicked, the application should display a message box with the sum of all the integers from 1 through the value entered by the user, as shown.  Use a loop to calculate this value.

If the user enters a negative value, the application should display an error message.

User the following test data to determine if the application is calculating properly:

              Value                Sum

                      5                    15

                    10                    55

                    20                  210

                  100                5050

Compress the solution folder that you have created into a Zip file and upload into Canvas.