23 lines
326 B
C++
23 lines
326 B
C++
#include <iostream>
|
|
using namespace std;
|
|
|
|
int main()
|
|
{
|
|
int i,n;
|
|
float zl,suma;
|
|
float f[100];
|
|
cout<<"n = ";
|
|
cin>>n;
|
|
f[0]=0;
|
|
f[1]=1;
|
|
cout<<f[0]<<" "<<f[1]<<" ";
|
|
for(i=2;i<=n;i++){
|
|
f[i]=f[i-1]+f[i-2];
|
|
cout<<f[i]<<" ";
|
|
}
|
|
cout<<"\n zl = "<<f[n]/f[n-1];
|
|
|
|
return 0;
|
|
}
|
|
|