fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int X,y;
  7. cin >> X>>y;
  8. bool l = true;
  9. for (int i = X;i<=y;i++)
  10.  
  11. {bool ok = true;
  12.  
  13. for (int m = i;m ;m /= 10) {
  14. int last = m % 10;
  15.  
  16. if(last == 4 || last == 7){}
  17.  
  18. else { ok = false;
  19.  
  20. }
  21.  
  22. }
  23. if (ok == true) {
  24. cout << i << " ";
  25. l = false;
  26. }
  27.  
  28. }
  29. if (l == true) { cout << -1; }
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
-1