25 lines
406 B
C++
25 lines
406 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int i, n;
|
|
float suma;
|
|
int f0 = 0, f1 = 1;
|
|
float zl;
|
|
|
|
cout << "N = ";
|
|
cin >> n;
|
|
cout << f0 << " " << f1 << " ";
|
|
|
|
for (i = 2; i <= n; i++) {
|
|
suma = f0 + f1;
|
|
cout << suma << " ";
|
|
f0 = f1;
|
|
f1 = suma;
|
|
}
|
|
|
|
zl = suma / f0;
|
|
cout << "\nZlota liczba = " << zl << endl;
|
|
|
|
return 0;
|
|
}
|