Strona główna > Ciągi > Ciąg Fibonacciego

Ciąg Fibonacciego

8 Październik 2009 Dodaj komentarz Go to comments
#include <iostream>
using namespace std;
float fib(float n);
main()
{
float n,x;
cout<<"Podaj n: "; cin>>n;
cout<<n<<"-ty wyraz ciagu = "<<fib(n)<<endl;
for (x=1; x<=10; x++)
{
cout<<x<<" element = "<<fib(x)<<endl;
}
system ("pause");
return 0;
}
float fib(float n)
{
if (n==0)
return 0;
else if (n==1)
return 1;
else if (n>1)
return fib(n-2)+fib(n-1);
}
  1. 21 Lipiec 2013 o 8:42 am

    If some one wishes to be updated with most up-to-date technologies after that
    he must be pay a quick visit this web site and be up to date everyday.

  2. 24 Marzec 2016 o 4:49 am

    Excellent post. Keep writing such kind of info on your blog.
    Im really impressed by it.
    Hey there, You’ve performed an incredible job. I’ll definitely digg it and personally suggest to my friends.
    I’m confident they’ll be benefited from this site.

  3. 31 Lipiec 2016 o 9:29 am

    Can I simply say what a relief to uncover someone that actually knows what they’re talking about on the web.

    You definitely know how to bring an issue to light and make it important.
    More people ought to look at this and understand this side of your story.
    I was surprised that you aren’t more popular since you surely have the gift.

  1. No trackbacks yet.

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Log Out / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Log Out / Zmień )

Facebook photo

Komentujesz korzystając z konta Facebook. Log Out / Zmień )

Google+ photo

Komentujesz korzystając z konta Google+. Log Out / Zmień )

Connecting to %s

%d bloggers like this: