Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Oct 8th, 2006, 3:46 PM   #1
baldy1324
Newbie
 
Join Date: Oct 2006
Location: texas
Posts: 3
Rep Power: 0 baldy1324 is on a distinguished road
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
baldy1324 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:57 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC