SOURCE CODE
puts " =====MENU===== "
puts "1. Penjumlahan"
puts "2. Pengurangan"
puts "3. Perkalian"
puts "4. Pembagian"
puts " "
print "Pilihan Menu = "
n = gets.to_i
print "Masukan Nilai pertama
= "
a = gets.to_i
print "Masukan Nilai Kedua =
"
b = gets.to_i
if n == 1 then
c = a + b
print c
elsif n == 2 then
c = a - b
print c
elsif n == 3 then
c = a * b
print c
elsif n == 4 then
c = a / b
print c
else
print "Pilihan Menu Tidak Ada"
end
OUTPUT
-MEMBUAT BINTANG-
SOURCE CODE
print "Masukan Banyaknya
Bintang = "
n = gets.to_i
for i in 1..n
for n in 1..n-1
print " "
end
for m in 1..i
print "* "
end
puts " "
end
OUTPUT
0 komentar:
Posting Komentar