Sub Main()
XX:
Console.Clear()
Console.Write("Bilangan 1 : ")
Dim Angka1 As Double
Angka1 = Console.ReadLine()
Console.Write("Operasi (x,/,+,-) : ")
Dim Operasi As String
Operasi = Console.ReadLine()
Console.Write("Bilangan 2 : ")
Dim Angka2 As Double
Angka2 = Console.ReadLine()
Select Case UCase(Operasi)
Case "X"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 * Angka2)
Case "/"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 / Angka2)
Case "+"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 + Angka2)
Case "-"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 - Angka2)
Case Else
Console.WriteLine()
Console.WriteLine("Anda salah memasukkan operasi")
End Select
Console.WriteLine()
Console.WriteLine("----------------------------------------")
Console.Write("Ulangi lagi? (Y/T): ")
Dim xUlang As String
xUlang = Console.ReadLine()
Select Case UCase(xUlang)
Case "Y"
GoTo XX
Case Else
Console.Write("Terima Kasih")
Console.ReadLine()
End Select
End Sub
XX:
Console.Clear()
Console.Write("Bilangan 1 : ")
Dim Angka1 As Double
Angka1 = Console.ReadLine()
Console.Write("Operasi (x,/,+,-) : ")
Dim Operasi As String
Operasi = Console.ReadLine()
Console.Write("Bilangan 2 : ")
Dim Angka2 As Double
Angka2 = Console.ReadLine()
Select Case UCase(Operasi)
Case "X"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 * Angka2)
Case "/"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 / Angka2)
Case "+"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 + Angka2)
Case "-"
Console.WriteLine()
Console.WriteLine("--------------------------")
Console.WriteLine()
Console.Write("Hasil : ")
Console.WriteLine(Angka1 - Angka2)
Case Else
Console.WriteLine()
Console.WriteLine("Anda salah memasukkan operasi")
End Select
Console.WriteLine()
Console.WriteLine("----------------------------------------")
Console.Write("Ulangi lagi? (Y/T): ")
Dim xUlang As String
xUlang = Console.ReadLine()
Select Case UCase(xUlang)
Case "Y"
GoTo XX
Case Else
Console.Write("Terima Kasih")
Console.ReadLine()
End Select
End Sub
mudah-mudahan postingan ini dapat menjawab pertanyaan dari sahabat blogger dan berguna juga untuk yang lain..
selamat mencoba...
Tidak ada komentar:
Posting Komentar