Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1.
- #include<fstream>
- using namespace std;
- int n;
- int main()
- {
- ifstream f("date.in");
- ofstream g("date.out");
- f>>n;
- if (n==1) { g<<"0"; f.close();g.close();return 0;}
- if (n==2) { g<<"0,1";f.close();g.close();return 0;}
- int ultim=1,curent,penultim=0,k=2;
- g<<endl<<"0";
- g<<endl<<"1";
- do {
- curent=ultim+penultim;
- penultim=ultim;
- ultim=curent;
- k++;
- g<<endl<<curent;
- } while (k<n);
- return 0;}
- 2.
- #include<fstream>
- using namespace std;
- int n;
- int main()
- {
- ifstream f("date.in");
- ofstream g("date.out");
- f>>n;
- if (n==0) { g<<"0"; f.close();g.close();return 0;}
- if (n==1) { g<<"0";f.close();g.close();return 0;}
- int ultim=1,curent,penultim=0;
- do {
- curent=ultim+penultim;
- penultim=ultim;
- ultim=curent;
- } while (curent<=n);
- if(curent==n)
- g<<"0";
- else
- g<<"1";
- return 0;}
- 3.
- #include<fstream>
- using namespace std;
- int n;
- int main()
- {
- ifstream f("date.in");
- ofstream g("date.out");
- f>>n;
- if (n==1) { g<<"0"; f.close();g.close();return 0;}
- float ultim=1,curent,penultim=0;
- int k=1;
- g<<"0";
- do {
- curent=ultim+penultim;
- penultim=ultim;
- ultim=curent;
- k++;
- g<<endl<<penultim/curent;
- } while (k<n);
- return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement