Ruby
xxxxxxxxxx
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
Enter the number of terms:- 15 The first 15 terms of Fibonacci series are:- 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610
Linux - Как установить anc-api-tools
Linux - Как установить curvedns
Python - Проверьте, является ли число положительным, отрицательным или 0
Linux - Как установить zenmap
C - Подсчитать количество цифр в целом числе
C++ - Проверить високосный год
JavaScript - Проверьте, начинается ли строка и заканчивается ли она определенными символами
C++ - Проверить, является ли число простым или нет
C - Найдите наибольшее число, используя динамическое выделение памяти
Kotlin - Перевернуть число
Kotlin - Округлить число до n знаков после запятой
Linux - Как установить xbitmaps
Linux - Как установить zstd
Java - Перевернуть число
Linux - Как установить zfs-test
Python - Запись файлов Excel (XLSX)
C++ - Найти частное и остаток
Linux - Как установить zookeeper-bin
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month