BLOGGER TEMPLATES AND YouTube Layouts »

About Me

Foto Saya
Priyadi Barryn
Lihat profil lengkapku

Rabu, 07 April 2010

LA Ruby 7april

x=0
while x!=3
puts "MENU","1. Akreditasi","2. Kalkulator","3. Exit"
print "masukkan pilihan : "
x=gets.to_i
if x==1
print "\n","jumlah mahasiswa : "
mhs=gets.to_i
for i in 1..mhs
print "data ke ",i,"\n","masukkan nama : "
nama = gets
print "masukkan npm : "
npm = gets.to_i
print "nilai uts : "
uts = gets.to_f
print "nilai uas : "
uas = gets.to_f
c=uts*0.7+uas*0.3
print "nilai total : ",c,"\n"
case c
when 85..100 then puts "#{nama}mendapat A","\n"
when 75..85 then puts "#{nama}mendapat B","\n"
when 60..75 then puts "#{nama}mendapat C","\n"
when 45..60 then puts "#{nama}mendapat D","\n"
when 0..45 then puts "#{nama}mendapat E","\n"
end
end
elsif x==2
print "\n","masukkan angka pertama : "
a=gets.to_f
print "masukkan angka kedua : "
b=gets.to_f
print a," + ",b," = ",a+b,"\n"
print a," - ",b," = ",a-b,"\n"
print a," * ",b," = ",a*b,"\n"
print a," / ",b," = ",a/b,"\n","\n"
elsif x==3
print ""
else
puts "","salah masukkin pilihan oi!!",""
end
end




untuk lebih jelasnya silahkan di
http://www.4shared.com/file/259153020/4545298/LISTING.html

0 komentar: