Strona główna > C++, Ciągi, Rekurencja > Ciąg arytmetyczny (rekurencyjnie)

Ciąg arytmetyczny (rekurencyjnie)

22 Listopad 2009 Dodaj komentarz Go to comments
//n - ty wyraz ciagu arytmetycznego rekurencyjnie
# include <iostream>
using namespace std;
long int c_a(int n, int a, int r);
int a,r,n,k;
int main ()
{
    cout<<"Podaj a: "; cin>>a;
    cout<<"Podaj r : "; cin>>r;
    cout<<"Ktory wyaraz wyznaczyc?  "; cin>>n;
    cout<<n<<" - wyraz ciagu arytmetycznego = "<<c_a(n,a,r)<<endl;
    cout<<"Ile wyrazow wypisac?  "; cin>>k;
    for (int i=1; i<=k; i++)
    cout<<i<<" = "<<c_a(i,a,r)<<endl;
    system("pause");
    return 0;
}
long int c_a(int n, int a, int r)
{
     if (n==1)
     return a;
     else
     return c_a(n-1,a,r)+r;
}



Kategorie:C++, Ciągi, Rekurencja Tags: ,
  1. 15 Grudzień 2012 o 8:55 pm

    Thanks for sharing your thoughts. I really appreciate your efforts and I am waiting for your
    next write ups thank you once again.

  2. 27 Sierpień 2013 o 6:46 pm

    I have read some good stuff here. Definitely worth bookmarking for revisiting.

    I wonder how so much attempt you place to make any such great informative website.

  3. 14 Maj 2014 o 3:34 pm

    Everyone loves what you guys are usually up too.
    This sort of clever work and exposure! Keep up the superb works guys
    I’ve included you guys to my blogroll.

  4. 13 Czerwiec 2014 o 1:07 am

    On their first mission, they brought back live chickens and ducks which they had captured.
    During gameplay you also can choose different weapons depending on the ones
    you have unlocked during the campaign so you get additional customization the further into the
    game you get. Three types of Titans have been announced so far,
    and each of them possesses different characteristics.

  5. 13 Sierpień 2014 o 1:49 am

    It’s remarkable to visit this web page and reading the views of all colleagues concerning this post, while I am also keen of
    getting knowledge.

  6. 23 Październik 2014 o 10:36 am

    If some one desires expert view concerning running a blog afterward i suggest him/her to pay a visit this blog, Keep up the pleasant work.

  7. 23 Listopad 2014 o 12:33 am

    Hello everyone, it’s my first pay a visit at this web site, and piece
    of writing is truly fruitful in support of me, keep up posting these types of articles.

  8. 23 Listopad 2014 o 10:39 pm

    I’m impressed, I must say. Rarely do I come across a blog that’s both educative
    andd entertaining, and without a doubt, you have hit the nail oon the head.
    Thee problem is something not enough people are speaking inteligently
    about. Now i’m very happy that I came across this in mmy hunt
    forr something concerning this.

  9. 12 Styczeń 2015 o 8:43 am

    Hi there colleagues, how is all, and what you wish for to say regarding this paragraph, in my view its really awesome
    designed for me.

  10. 17 Styczeń 2015 o 10:33 am

    Based mostly strictly on the efficiency data from each webhost, there have
    been three hosts that basically stood out within the
    group.

  11. 10 Luty 2015 o 6:17 am

    Merci grandement pour vos ressources !

  12. 16 Marzec 2015 o 9:22 am

    hi!,I love your writing so a lot! share we keep up a correspondence more approximately your article on AOL?
    I need a specialist on this house to resolve my problem.
    Maybe that’s you! Taking a look forward to peer you.

  13. 25 Sierpień 2015 o 11:31 am

    Admiring the commitment you put into your blog and detailed information you provide.
    It’s awesome to come across a blog every once in a while that isn’t
    the same out of date rehashed information. Great read! I’ve
    saved your site and I’m including your RSS feeds to my Google account.

  14. 27 Listopad 2016 o 11:09 am

    Thank you for the auspicious writeup. It in fact was once a
    enjoyment account it. Glance advanced to far brought agreeable from you!
    However, how can we be in contact?

  1. 24 Maj 2015 o 2:05 am

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: