+ 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
20 Antworten
+ 7
My try on C++ :
https://code.sololearn.com/co1wKcl06K2R/#cpp
+ 7
https://code.sololearn.com/c0EN6vuf0Hsi/?ref=app
https://code.sololearn.com/chnunsPVmqtY/?ref=app
https://code.sololearn.com/cP4T5IQfJhD2/?ref=app
https://code.sololearn.com/ciX49EoG7r1q/?ref=app
+ 7
My try in Ruby:
https://code.sololearn.com/cqKC8w2Ds7fH/#rb
+ 7
https://code.sololearn.com/cMCT5gCs1isZ/?ref=app
+ 7
First challenge. Java
https://code.sololearn.com/cDKQTRr81Qvm/?ref=app
+ 7
https://code.sololearn.com/c76KT0VWeyN1/?ref=app
+ 6
Here's mine
https://code.sololearn.com/cM8HVyQmi6ut/?ref=app
+ 6
https://code.sololearn.com/co0qpi10eyab/?ref=app
+ 6
here is my code!!!
https://code.sololearn.com/cZ2lrwM9e9mQ/?ref=app
+ 5
https://code.sololearn.com/c987mfs8obb9/?ref=app
+ 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;
}
+ 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();
}
+ 2
Has someone a Solution in python3?
+ 1
Also on python3 (first code on python):
https://code.sololearn.com/c46lRWTjIT06/#py
0
https://code.sololearn.com/cFSrGw3QKTa1/?ref=app