Adding Two Numbers with Variables
Write a program that asks the user to enter in two numbers and then to add them and show the answer. You are required to draw the IPO as well as the user interface and write the code for this program,using variables to determine your answer.
IPO Framework
Input | Process | Output |
Enter first number (num1) | | |
Enter second number (num2) | ||
| Add first number (num1) to the second number (num2) | |
| | The sum of both numbers (answers) |
User Interface
Public Class frmaddnums
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, sum As Integer
num1 = Val(txtnum1.Text)
num2 = Val(txtnum2.Text)
sum = num1 + num2
lblans.Text = sum
End Sub
End Class
No comments:
Post a Comment