Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created June 24, 2013 15:56
Show Gist options
  • Select an option

  • Save jamesmichiemo/5851124 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmichiemo/5851124 to your computer and use it in GitHub Desktop.
Conditional expressions written in Ruby language
# Numerical Grade Converter
#
print "What percentage is your grade? "
gradePercent = gets.chomp().to_f
if gradePercent <= 69
puts "You have earned an F in the class!"
elsif gradePercent <= 72
puts "You have earned a D in the class!"
elsif gradePercent <= 75
puts "You have earned a C in the class!"
elsif gradePercent <= 79
puts "You have earned a C+ in the class!"
elsif gradePercent <= 84
puts "You have earned a B in the class!"
elsif gradePercent <= 89
puts "You have earned a B+ in the class!"
elsif gradePercent <= 94
puts "You have earned an A in the class!"
elsif gradePercent <= 100
puts "You have earned an A+ in the class!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment