Menampilkan Bilangan Fibonacci

#include<iostream>
#include<conio.h>
main()
{
    int x, y, i, n;
    printf("\tMENAMPILKAN BILANGAN FIBONACCI \n ");
    printf("=============================================\n ");
    printf("\tNAMA\t: A.B ARHAMMUDDIN\n ");
    printf("\tNIM\t: 2015141106\n ");
    printf("=============================================\n ");
    printf("\n ");
    n=21;
    x=1;
    y=0;
    printf("%d ",y);
    i=1;
    for(i=0; i<=n-1; i++)
    {
        printf("%d ",x);
        x=x+y;
        y=x-y;
        i++;
    }
    getch();
    return 0;
}

Lat6_4.cpp Halaman 28 -> Tugas Praktikum Pertemuan 6 { D }

Comments

Populer

Full Modul Kuliah "Teknik Informatika" Universitas Pamulang - UNPAM

Full Modul Kuliah "Teknik Informatika"

Implementasi Stack