0% found this document useful (0 votes)
17 views6 pages

Input

The document contains a series of programs written in BASIC for performing various mathematical calculations, including product, area of a circle, simple interest, sum, average, and area of a triangle. It also includes a Visual Basic class for a calculator application with functions for basic arithmetic operations, trigonometric calculations, logarithm, square root, and percentage. The code features user input handling and displays results in a text box.

Uploaded by

Adetola Olamide
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views6 pages

Input

The document contains a series of programs written in BASIC for performing various mathematical calculations, including product, area of a circle, simple interest, sum, average, and area of a triangle. It also includes a Visual Basic class for a calculator application with functions for basic arithmetic operations, trigonometric calculations, logarithm, square root, and percentage. The code features user input handling and displays results in a text box.

Uploaded by

Adetola Olamide
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

INPUT " ENTER SECOND NUMBER:";Y

INPUT " ENTER THIRD NUMBER:";Z

LET PRODUCT = X*Y*Z

PRINT " THE PRODUCT IS:", PRODUCT

20 REM PROGRAM TO CALCULATE AREA OF CIRCLE

INPUT "20 ENTER RADIUS:";R

PI=3.141593

LET AREA = PI*R*R

PRINT " THE AREA IS:", AREA

30 REM PROGRAM TO CALCULATE SIMPLE INTEREST

INPUT "30 ENTER THE PRINCIPAL:";P

INPUT " ENTER THE RATE:";R

INPUT " ENTER THE TIME:";T

LET SI=(P*R*T)/100

PRINT " THE SIMPLE INTEREST:", SI

40 REM PROGRAM TO CALCULATE SUM

INPUT "40 FIRST NUMBER:";Y

INPUT " SECOND NUMBER:";Z

LET SUM = Y+Z

PRINT " THE SUM IS:", SUM

50 REM PROGRAM TO CALCULATE AVERAGE


INPUT "50 ENTER FIRST NUMBER:";A

INPUT " ENTER SECOND NUMBER:";B

INPUT " ENTER THIRD NUMBER:";C

LET AVERAGE = (A+B+C)/3

PRINT " THE AVERAGE IS:",AVERAGE

60 REM PROGRAM TO CALCULATE AREA OF TRIANGLE

INPUT "60 ENTER BASE:";B

INPUT " ENTER HEIGHT:";H

LET AREA = (B*H)/2

PRINT " THE AREA IS:", AREA

70 REM PROGRAM TO CALCULATE PRODUCT

INPUT "7 ENTER FIRST NUMBER:";P

INPUT " ENTER SECOND NUMBER:";Q

INPUT " ENTER THIRD NUMBER:";R

INPUT " ENTER FOURTH NUMBER:";S

LET PRODUCT = P*Q*R*S

PRINT " THE PRODUCT IS:",PRODUCT

80 REM PROGRAM TO CALCULATE AVERAGE

INPUT "8 ENTER FIRST NUMBER:";A

INPUT " ENTER SECOND NUMBER:";B

INPUT " ENTER THIRD NUMBER:";C

INPUT " ENTER FOURTH NUMBER:";D

INPUT " ENTER FIFTH NUMBER:";E


LET AVERAGE = (A+B+C+D+E)/5

PRINT " THE AVERAGE IS:",AVERAGE

OOU CSC

Public Class Form1


Dim firstnum As Integer
Dim secondnum As Integer
Dim operation As Integer
Dim operator_selector As Boolean = False
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
firstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operation = 4 ' = /
End Sub

Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click


firstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operation = 3 ' = *
End Sub

Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "3"
Else
TextBox1.Text = "3"
End If
End Sub

Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "2"
Else
TextBox1.Text = "2"
End If
End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click


firstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operation = 2 ' = -
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "6"
Else
TextBox1.Text = "6"
End If
End Sub

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "5"
Else
TextBox1.Text = "5"
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "7"
Else
TextBox1.Text = "7"
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "8"
Else
TextBox1.Text = "8"
End If
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "9"
Else
TextBox1.Text = "9"
End If
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


firstnum = TextBox1.Text
TextBox1.Text = "0"
operator_selector = True
operation = 1 ' = +

End Sub

Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click


If Not (TextBox1.Text.Contains(".")) Then
TextBox1.Text += "."
End If
End Sub

Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click


TextBox1.Text = "0"
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
If TextBox1.Text <> "0" Then
TextBox1.Text += "4"
Else
TextBox1.Text = "4"
End If
End Sub

Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "1"
Else
TextBox1.Text = "1"
End If
End Sub

Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click


If TextBox1.Text <> "0" Then
TextBox1.Text += "0"
Else
TextBox1.Text = "1"
End If
End Sub

Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click


If operator_selector = True Then
secondnum = TextBox1.Text
If operation = 1 Then
TextBox1.Text = firstnum + secondnum
ElseIf operation = 2 Then
TextBox1.Text = firstnum - secondnum
ElseIf operation = 3 Then
TextBox1.Text = firstnum * secondnum
Else
If secondnum = 0 Then
TextBox1.Text = "Error!"
ElseIf operation = 4 Then
TextBox1.Text = firstnum / secondnum
End If
End If
operator_selector = False

End If
End Sub

Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click


Dim Sine = Convert.ToDouble(TextBox1.Text)
Sine = Math.Sin(Sine)
TextBox1.Text = Sine.ToString
End Sub

Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click


Dim Cos As Double = Convert.ToDouble(TextBox1.Text)
Cos = Math.Cos(Cos)
TextBox1.Text = Cos.ToString()
End Sub

Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click


Dim Tan As Double = Convert.ToDouble(TextBox1.Text)
Tan = Math.Tan(Tan)
TextBox1.Text = Tan.ToString()
End Sub

Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click


Dim Log As Double
Log = Convert.ToDouble(TextBox1.Text)
Log = Math.Log10(Log)
TextBox1.Text = Convert.ToString(Log)
End Sub

Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click


Dim Sqrt As Double
Sqrt = Convert.ToDouble(TextBox1.Text)
Sqrt = Math.Sqrt(Sqrt)
TextBox1.Text = Convert.ToString(Sqrt)
End Sub

Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click


Dim Sq As Double
Sq = Convert.ToDouble(TextBox1.Text)
TextBox1.Text = Convert.ToString(Sq * Sq)
End Sub

Private Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.Click


Dim Sq As Double
Sq = Convert.ToDouble(TextBox1.Text)
TextBox1.Text = Convert.ToString(Sq * Sq * Sq)
End Sub

Private Sub Button25_Click(sender As Object, e As EventArgs) Handles Button25.Click


Dim Percent As Double
Percent = Convert.ToDouble(TextBox1.Text) / Convert.ToDouble(100)
TextBox1.Text = Convert.ToString(Percent)
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub
End Class

You might also like