Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- ///CU FORMULA
- /*
- int main()
- {
- ifstream f("numere.in");
- int x;
- bool gasit=false;
- while(f>>x)
- if(x%3==1)
- {
- cout<<x<<" ";
- gasit=true;
- }
- if (gasit==false)
- cout<<"nu exista";
- }
- */
- int main()
- {
- ifstream f("numere.in");
- int x, f1=1, f2=4, f3;
- bool gasit=false;
- while(f>>x)
- {
- while(f1<x)
- {
- f3=2*f2-f1;
- f1=f2;
- f2=f3;
- }
- if(f1==x)
- {
- cout<<x<<" ";
- gasit=true;
- }
- }
- if(gasit==false)
- cout<<"Nu exista";
- }
Advertisement
Add Comment
Please, Sign In to add comment