Read more : http://www.wakrizki.net/2011/03/membuat-effek-zoom-gambar-di-blog.html#ixzz1PJMAYpiS

TUGAS MANDIRI 1 ALGORITMA & STRUKTUR DATA (FIBONANCI)

1. Menampilkan bilangan fibonanci menggunakan pointer dengan malloc. Tampilkan bilangan fibonanci pertama sampai ke-n menggunakan pointer dengan malloc, dimana n dimasukkan oleh user! Jawab :

Analisa Dalam menampilkan deretan bilangan fibonanci, dimana batasan untuk bilangan diinputkan oleh user maka digunakannya fungsi scanf : printf ("Masukkan Batas Maksimal = "); scanf ("%d", &batas); Sedangkan untuk mengalokasikan memori dg besar tertentu maka digunakan nya malloc dengan sebuah variable batas dimana variable batas merupakan variable yang nilainya diinput oleh user sebagai nilai batas untuk menampilkan deret bilangan fibonanci. fibo = (int *)malloc (batas * sizeof(int)); *(fibo + 1) =1; *(fibo + 2) =1; for (i=3;i<=batas;i++) *(fibo + i)= (*(fibo + i - 2) + *(fibo + i - 1)); Dalam menampilkan deretan fibonanci dengan menggunakan batasan maka digunakannya perulangan dengan for : printf("%d Bilangan Fibonanci Pertama adalah : \n",batas); for (i=1;i<=batas;i++) printf("%d",*(fibo+i)); printf("\n"); Agar user dapat mengalokasikan ulang memori yang dipesannya (mengubah batasan), maka digunakannya fungsi realloc(), dimana terdapat variable ganti sebagai variable untuk batasan pengganti dari varibel batas : fibo = realloc (fibo, ganti * sizeof(int));


Baca Juga Artikel Menarik Lainnya :

13 komentar:

  1. Bell Mobility Cell Phones CanadaHere are the very best Bell Mobility
    Cell Phones available today, based on my analysis and user reviews.
    Buy this quality cell phone protector case for
    your LG enV Touch VX11000 today and we'll ship it to your home or business for less! Limited supply - ORDER YOURS TODAY! http://Www.Oasislive.it/wiki/index.php?title=Don_t_Let_Your_Kids_Or_Yourselves-become_Slaves_To_Cell_Phone_Babbling To answer a call, you raise your hand to your ear, as shown. To hang up, you lower your hand. You can also make outgoing calls, but only to a few pre-programmed numbers as you might assume; there's no "touch screen" on this dress.
    West Orange police Sgt. John Palardy told The West Orange Patch
    officials were unsure whether the robber fled the bank by foot or by car.
    My site ; cell phone number lookup

    BalasHapus
  2. Me new to blogging. How do I put in a subscribe
    function to my site so new post will go to their email?



    Review my homepage; www.gzlongyi.cn
    My web blog Paxil

    BalasHapus
  3. Discount Harley-Davidson Cell Phones Cases Harley-Davidson
    fans are not just men. Harley-Davidson cell phone cases are unisex, but there are some pink Harley Davidson iPhone cases are on sale
    at 50% off at Amazon. The Harley iPhone and smartphone cases and sleeves are well crafted and show off the Harley-Davidson uniqueness that comes with everything that is Harley-Davidson. Apple iPhone cases are often bland, but getting a Harley case adds a whole new layer of personality to the phone. A Harley Davidson cell phone case is a great Valentine's day gift, birthday gift or surprise present. Check through some of the Harley case photos. Amazon sells Officially Licensed Harley Davidson gear. Harley-Davidson cases, covers, and cell phone skins are currently discounted at 50% off.
    It is hard to find any cheap Apple iPhone case so the discount Harley cell phone cases and covers
    are a great deal. They weren't driving her to the airport, she thought. It was all a setup. http://tinyurl.com/aochyud My guess is that at the very least AT&T wants to point out that its version of the iPhone 4 S is superior to other versions of the same device being sold on Verizon's and Sprint's networks. In fairness to AT&T, there is a difference between the GSM version of the device and the CDMA version sold by Verizon and Sprint. According to report, 58 percent of state and local law enforcement agencies reported that criminal gangs were active in their jurisdictions in 2008 compared with 45 percent of state and local agencies in 2004.
    My page > reverse phone lookup cell

    BalasHapus
  4. Do you know the best websites and blogs dedicated to reading
    and literature?

    Feel free to visit my blog post ... transvaginal mesh compensation

    BalasHapus
  5. Great blog here! Also your site loads up very fast!
    What web host are you using? Can I get your affiliate link to your
    host? I wish my site loaded up as fast as yours lol

    Also visit my webpage ... root Canal

    BalasHapus
  6. No two of us are the same. We have different biochemistries,
    different lifestyles and differed point of views. No one plan will work for
    everyone.

    Stop by my web blog ... ketone

    BalasHapus
  7. Keep this going please, great job!

    Feel free to surf to my website :: PBU Dental

    BalasHapus
  8. I used to be able to find good information from your blog posts.


    Feel free to surf to my webpage; http://www.slopemediagroup.com/properties/choosing-a-dentist-in-delhi/

    BalasHapus
  9. Asking questions are in fact nice thing if you are not understanding
    something fully, however this article presents good understanding even.


    Check out my web page: HTTP://Www.Reservistavoluntario.Es/Modules.Php?Name=Your_Account&Op=Userinfo&Username=CamilleHe

    BalasHapus
  10. It's remarkable for me to have a web site, which is useful in favor of my know-how. thanks admin

    My website: tattoo removal cream reviews

    BalasHapus
  11. great issues altogether, you just received a emblem new reader.
    What would you recommend about your put up that you made a few days in the past?
    Any positive?

    Here is my web blog - coconut oil for hair

    BalasHapus
  12. What's up, I would like to subscribe for this blog to take latest updates, thus where can i do it please help.

    Visit my web site; diamondlinks review

    BalasHapus