Lucian_Adrian

#61 AfisareDivizoriComuni

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