puts "Kalkulator Mini"
print "Masukkan Nilai pertama = "
nilai1 = gets.to_f
print "Masukkan Nilai kedua = "
nilai2 = gets.to_f
jmlh = nilai1 + nilai2
kurang = nilai1 - nilai2
kali = nilai1 * nilai2
bagi = nilai1 / nilai2
pangkat = nilai1 ** nilai2
print "\nHASIL\n"
puts "Penjumlahan"
print nilai1, " + ", nilai2, " = ", jmlh
print "\n"
puts "Pengurangan"
print nilai1, " - ", nilai2, " = ", kurang
print "\n"
puts "Perkalian"
print nilai1, " X ", nilai2, " = ", kali
print "\n"
puts "Pembagian"
print nilai1, " / ", nilai2, " = ", bagi
print "\n"
puts "Perpangkatan"
print nilai1, " ^ ", nilai2, " = ", pangkat
print "\n"
Like this:
Like Loading...
Related