Quick actions

cmd+k|ctrl+k

Navigation

Languages

5. Menghitung Deret Fibonacci

Snippet info

Language

Cpp

Visibility

public

Author

dhafinshabir610

Created

2025-01-13T12:49:11.657516Z

Updated

2025-01-13T12:50:56.41773Z

#include <iostream>

// NAMA : Dhafin Shabir Alfatih
// NIM  : 3420230036

using namespace std;

int main() {
    int a, b, c, i;

    cout << "Program Menghitung Deret Fibonacci" << endl;
    cout << "Masukkan bilangan pertama: ";
    cin >> a;
    cout << endl;
    cout << "Masukkan bilangan kedua: ";
    cin >> b;
    cout << endl;

    cout << a << " " << b << " ";
    for (i = 0; i < 10; i++) {
        c = a + b;
        cout << c << " ";
        a = b;
        b = c;
    }
    
    cout << endl;
    return 0;
}
INFO