fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // Input
  6. int a, b;
  7. cin >> a >> b;
  8.  
  9. // Process -> Output
  10. if (a > b) swap(a, b);
  11.  
  12. int tmp = a / 3;
  13. if (a % 3 != 0) ++tmp;
  14. a = tmp*3;
  15.  
  16. for (int i = a; i <= b; i += 3)
  17. cout << i << ' ';
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0.01s 5288KB
stdin
3 100
stdout
3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99