Computer Science, asked by nataliamoirangthem, 3 months ago

write a program to create a basic calculator in visual basic.


Anonymous: which languagen
nataliamoirangthem: ??
Anonymous: you have to tell me the language you wanna use to create a calculator

Answers

Answered by sorathiya
0

Answer:

Private Sub Command1_Click()

Dim ans, n1, n2 As Integer

n1 = Val(txt1.Text)

n2 = Val(txt2.Text)

ans = n1 + n2

txtans.Text = ans

End Sub

Private Sub Command2_Click()

Dim ans, n1, n2 As Integer

n1 = Val(txt1.Text)

n2 = Val(txt2.Text)

ans = n1 - n2

txtans.Text = ans

End Sub

Private Sub Command3_Click()

Dim ans, n1, n2 As Integer

n1 = Val(txt1.Text)

n2 = Val(txt2.Text)

ans = n1 * n2

txtans.Text = ans

End Sub

Private Sub Command4_Click()

Dim ans, n1, n2 As Integer

n1 = Val(txt1.Text)

n2 = Val(txt2.Text)

ans = n1 / n2

txtans.Text = ans

End Sub

Private Sub Command6_Click()

txt1.Text = ""

txt2.Text = ""

txtans.Text = ""

End Sub

Similar questions