Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
96
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. int gcd(int a,int b)
  4. {
  5. if(b==0)
  6. return a;
  7. return gcd(b,a%b);
  8. }
  9. void div(int n)
  10. {
  11. int i,c=0;
  12. for(i=1;i*i<=n;i++)
  13. {
  14. if(n%i==0)
  15. {
  16. if(n/i==i)
  17. c+=1;
  18. else
  19. c+=2;
  20. }
  21. }
  22. printf("%d\n",c);
  23. }
  24.  
  25. int main() {
  26. int n1,n2,t;
  27. scanf("%d",&t);
  28. while(t--)
  29. {
  30. scanf("%d%d",&n1,&n2);
  31. div(gcd(n1,n2));
  32. }
  33.  
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement