Advertisement
Dizzy3113

Untitled

Nov 3rd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. int divxy(int x, int y)
  5. {
  6. if(x%y==0)
  7. return 1;
  8. else
  9. return 0;
  10. }
  11. int main()
  12. {
  13. int poz=0, v[100], a,b,n;
  14. cin>>a;
  15. cin>>b;
  16. cin>>n;
  17. if(a>b)
  18. {
  19. int aux=a;
  20. a=b;
  21. b=aux;
  22. }
  23.  
  24. for (int i=a; i<=b; i++)
  25. if(divxy(n, i)==1)
  26. {
  27. v[poz]=i;
  28. poz++;
  29. }
  30. for(int i=0; i<poz; i++)
  31. cout<<v[i]<<" ";
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement