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