"Which Century" programming exercise
Let's clarify the logic.  The code simplification will follow.  The rules are:


"th" years are those ending in 4, 5, 6, 7, 8, 9, or 0.  Additionally, the 11th, 12th, and 13th centuries are exceptions also ending in "th".
Years ending in 1 are "st" years.
Years ending in 2 are "nd" years.
Years ending in 3 are "rd" years.


Now just translate the above into code:

def which_century(string)
  century  = (string.to_f / 100).ceil
  year     = century % 10
  nth_year = (11..13).include?(century) || !(1..3).include?(year)
  return "#{century}th century" if nth_year
  return "#{century}st century" if year == 1
  return "#{century}nd century" if year == 2
  return "#{century}rd century" if year == 3
end