Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab6 task48b

Snippet info

Language

Cpp

Visibility

public

Author

niktyutenko

Created

2018-11-11T14:51:46Z

Updated

2018-11-17T09:52:41Z

#include <iostream>
using namespace std;
 
int main()
{
    int a, b, k, sum;
    a = 0;
    b = 1;
    cin >> k;
    while (k <= 0)
    {
        cout << "ERROR! Enter the number greater than zero: ";
        cin >> k;
    }
    while (k != 0)
    {
        a = a + b;
        b = a - b;
        k = k - 1;
        cout << a << " ";
    }
    sum = a + b + k;
    cout << "Summa vsem FIB: " << sum << endl;
    return 0;
}
INFO