fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a,b;
  6. cin>>a>>b;//a=20 b=52
  7. while(a!=b)
  8. {
  9. if (a<b)
  10. b=b-a;// b=32,b=12,b=4
  11. else
  12. a=a-b;//a=8,a=4
  13.  
  14. }
  15. for (int i=1;i<=a;i++)
  16. if (a%i==0)
  17. {
  18. cout<<i<<" ";
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0.23s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty