Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- #include <algorithm>
- using namespace std;
- bool check(int x)
- {
- while (x > 0)
- {
- if (x % 10 == 3)
- return true;
- x /= 10;
- }
- return false;
- }
- int main()
- {
- cout << "Enter N" << endl;
- int n;
- cin >> n;
- int a1 = 1, a2 = 1;
- while (a2 < n)
- {
- if (check(a2))
- cout << a2 << " ";
- int new_a1 = a2;
- int new_a2 = a1 + a2;
- a1 = new_a1;
- a2 = new_a2;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement