Program Kalkulator Sederhana Python

Listing

print " Kalakulator "
print "1. Penjumlahan"
print "2. Pengurangan"
print "3. Perkalian"
print "4. Pembagian"
print "5. Sisa Pembagian"
a = raw_input("Masukkan Pilihan[1-5] :")
if (a=="1"):
    print "Penjumlahan"
    a = float(raw_input("Masukkan nilai pertama = "))
    b = float(raw_input("Masukkan nilai kedua = "))
    c = a+b
    print a," + ",b," = ",c
    print (" ")
elif (a=="2"):
    print "Pengurangan"
    a = float(raw_input("Masukkan nilai pertama = "))
    b = float(raw_input("Masukkan nilai kedua = "))
    c = a-b
    print a," - ",b," = ",c
    print (" ")
elif (a=="3"):
    print "Perkalian"
    a = float(raw_input("Masukkan nilai pertama = "))
    b = float(raw_input("Masukkan nilai kedua = "))
    c = a*b
    print a," . ",b," = ",c
    print (" ")
elif (a=="4"):
    print "Pembagian"
    a = float(raw_input("Masukkan nilai pertama = "))
    b = float(raw_input("Masukkan nilai kedua = "))
    c = a/b
    print a," : ",b," = ",c
    print (" ")
elif (a=="5"):
    print "Sisa Bagi"
    a = float(raw_input("Masukkan nilai pertama = "))
    b = float(raw_input("Masukkan nilai kedua = "))
    c = a%b
    print "Hasil sisa bagi ",a," dengan ",b," = ",c
    print (" ")
else:

    print " Maaf Tidak Terdapat dalam Pilihan "

Output



Komentar

Postingan populer dari blog ini

Fixed Point dan Floating Point pada ALU

Pengenalan Teknologi Game dan Artificial Intelligence pada Game || Pengantar Teknologi Game || Tugas I

Program Deret Geometri Java