Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- ios_base::sync_with_stdio(false);
- cin.tie();
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- int a, b; cin >> a >> b;
- bool found = false;
- for(int i = a; i <= b; i++){
- bool is_lucky = true;
- int x = i;
- while(x){
- int curr_digit = x % 10;
- if(curr_digit != 7 and curr_digit != 4)
- is_lucky = false;
- x /= 10;
- }
- if(is_lucky){
- found = true;
- cout << i << ' ';
- }
- }
- if(not found)
- cout << -1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment