Advertisement
RusSimona

Varianta50 Sub3 Ex3

Dec 18th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int divxy(int x, int y)
  5. {
  6. if(x%y==0) return 1;
  7. if(y%x==0) return 1;
  8. return 0;
  9. }
  10.  
  11. int main ()
  12. {
  13.  
  14. int a,b,n,aux,i;
  15. cin>>a>>b>>n;
  16. if(a>b)
  17. {
  18. aux=a;
  19. a=b;
  20. b=aux;
  21. }
  22. for(i=a; i<=b; i++)
  23. if(divxy(i,n))
  24. if(i<=n)cout<<i<<" ";
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement