Ruby program to print Fibonacci series

Fibonacci program in Ruby
Fibonacci series is nothing but a series of numbers in which the current number is the sum of the previous two numbers

first=0
second=1
nextterm=0

puts "Enter the number of terms:-"
n=gets.chomp.to_i

puts "The first #{n} terms of Fibonacci series are:-"
c=1
while(c<=n+1)
    if(c<=1)
        nextterm=c
    else
        puts nextterm
        nextterm=first+second
        first=second
        second=nextterm
    end
    c+=1
end

 

Output

Enter the number of terms:-
 4
The first 4 terms of Fibonacci series are:-
1
1
2
3


Enter the number of terms:-
 6
The first 6 terms of Fibonacci series are:-
1
1
2
3
5
8