+ 8

Challenge: Produce Fibonacci numbers till the one given on input !

Create a program which generates Fibonacci series till a number 'n' where 'n' is entered by the user. For eg. if the user enters 10 then the output would be: 1 1 2 3 5 8

18th Oct 2017, 3:23 PM
Nikos And
Nikos And - avatar
20 Respuestas
6th Oct 2017, 4:00 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
6th Oct 2017, 3:29 PM
Nikos And
Nikos And - avatar
7th Oct 2017, 5:23 AM
noobcøder
noobcøder - avatar
+ 7
https://code.sololearn.com/cMCT5gCs1isZ/?ref=app
7th Oct 2017, 5:53 AM
Louis
Louis - avatar
7th Oct 2017, 10:36 AM
Marcus Raso
Marcus Raso - avatar
+ 7
https://code.sololearn.com/c76KT0VWeyN1/?ref=app
19th Oct 2017, 11:30 PM
David Ashton
David Ashton - avatar
18th Nov 2017, 4:27 PM
Raphael Williams
Raphael Williams - avatar
7th Oct 2017, 8:53 AM
Jonas Schröter
Jonas Schröter - avatar
+ 6
https://code.sololearn.com/co0qpi10eyab/?ref=app
9th Oct 2017, 8:08 AM
Andrew
Andrew - avatar
20th Oct 2017, 2:02 AM
Narasimha
+ 5
https://code.sololearn.com/c987mfs8obb9/?ref=app
6th Oct 2017, 11:07 PM
Emma
+ 4
#include<iostream> using namespace std; int main() { int a=0,b=1,c,n,i; cout<<"\n enter a positive real number"; cin>>n; cout<<"\n the fibonacci numbers are 0 1"; for(i=0;i<n;i++) { c=a+b; cout<<"\t"<<c; a=b; b=c; } return 0; }
7th Oct 2017, 3:35 PM
shanker
18th Oct 2017, 5:10 PM
Rishita
Rishita - avatar
+ 3
C++ #include<iostream.h> #include<conio.h> void fb() { int n,i,k=1; cout<<"enter n\n"; cin>>n; for(i=0;i<=n;i++) { cout<<k<<" "; k=k+i; } } void main() { clrscr(); fb(); getch(); }
7th Oct 2017, 1:58 PM
pawan sen
pawan sen - avatar
18th Oct 2017, 4:17 PM
Lucas Fialho
Lucas Fialho - avatar
+ 2
Has someone a Solution in python3?
8th Oct 2017, 7:39 AM
pkoster
17th Nov 2017, 1:35 AM
#RahulVerma
#RahulVerma - avatar
+ 1
Also on python3 (first code on python): https://code.sololearn.com/c46lRWTjIT06/#py
9th Apr 2018, 10:34 AM
Nikos And
Nikos And - avatar
0
https://code.sololearn.com/cFSrGw3QKTa1/?ref=app
28th May 2018, 2:08 PM
Shuaib Nuruddin
Shuaib Nuruddin - avatar