fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int A,B,K,N;
  6. cin>>A>>B>>K>>N;
  7. for(int i=A; i<=B; i++){
  8. if (i%K==0 and i%N!=0){
  9. cout<<i<<endl;
  10. }
  11. }
  12. return 0;
  13. }
Success #stdin #stdout 0.01s 5312KB
stdin
1 20 3 2
stdout
3
9
15