class Fibonacci
  def initialize(n)
    @n = n
  end

  def calculate
    if @n <= 1
      @n
    else
      a = 0
      b = 1
      (@n - 1).times do
        temp = a + b
        a = b
        b = temp
      end
      b
    end
  end
end

# Calculate the first 10 Fibonacci numbers
10.times do |i|
  fib = Fibonacci.new(i)
  puts "Fibonacci(#{i}) = #{fib.calculate}"
end