![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Oct 2006
Location: texas
Posts: 3
Rep Power: 0
![]() |
fibonacci sequence
hi i am diving into programming and wanting to find out the amount of time it takes to execute a fibonacci sequence program. i have had past expirience with c++ so i have that code. to make sure the way the program runs is the same, i would like it if this program used while loops, and other similar things. here is the c++ code -
#include <iostream>
using namespace std;
int main()
{
int n = 1000;
double first = 0;
double second = 1;
cout<<first<<" "<<second<<" ";
while (n--)
{
double third = first + second;
first = second;
second = third;
cout<<third<<" ";
}
}so if anyone can "convert" this to python it would be appreciated |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 500 Ways to Print the Fibonacci Sequence | uman | Coder's Corner Lounge | 19 | Aug 25th, 2006 12:48 PM |
| fibonacci sequence | angry_asian | C++ | 12 | Aug 15th, 2006 2:53 AM |
| First Python Programme: Fibonacci Finder | UnKnown X | Python | 2 | Dec 15th, 2005 6:19 PM |
| Fibonacci | lingon | Python | 8 | Apr 29th, 2005 6:22 PM |
| Help - Execution Sequence | anandt4u | C++ | 23 | Apr 8th, 2005 3:46 PM |