fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a,b,i;
  6. cin>>a>>b;
  7. while (a!=b)
  8. {
  9. if(a>b)
  10. {
  11. a=a-b;}
  12. else
  13. {b=b-a;
  14. }
  15. }
  16. for (i=1;i<=a;i++)
  17. if (a%i==0)
  18. cout<<i<<" ";
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5288KB
stdin
312 208
stdout
1 2 4 8 13 26 52 104