Bilangan Fibonacci Perintah While

#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=12;
    x=1;
    y=0;
    printf("%d ",y);
    i=1;
    while(i<=n-1)
    {
        printf("%d ",x);
        x=x+y;
        y=x-y;
        i++;
    }
    getch();
    return 0;
}

Lat7_2.cpp Halaman 31 -> Tugas Praktikum Pertemuan 7 { B }

No comments:

Post a Comment