fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int a, b, k, r;
  6. cin >> a >> b >> k;
  7. r = a % k;
  8. if (r != 0) {
  9. a += k - r;
  10. }
  11. for (int i = a; i <= b; i += k) {
  12. cout << i << " ";
  13. }
  14. return 0;
  15. }
Success #stdin #stdout 0s 5320KB
stdin
3 5 24
stdout
Standard output is empty