Visual Basic Code That Raises a Given Integer x to The Power n

NOTE THAT THIS IS NOT TO TEACH YOU BUT TO GIVE YOU HINTS AND INSIGHTS ON WHAT TO DO.

Here we are just introducing the caret (^) sign. The sign of power is the caret followed by the power you are raising to. Open the form and select the command button and input the code below into the command button.

Private Sub Command1_Click()
Dim x As Integer
Dim n As Integer

x = InputBox("Enter Integer")
n = InputBox("Enter the power")
Print x ^ n
End Sub

Run the program
This is as simple as it gets. Go and develop more on this and let us know.

Comments