Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;\
  4.  
  5.  
  6. int NWW(int a, int b){
  7. int x,A,B;
  8. A=a;
  9. B=b;
  10. if(a%b==0){
  11.     }
  12. else{
  13.     b=a%b;
  14.     if (b>a){
  15.         swap(a,b);
  16.     }
  17.     }
  18. x=(A*B)/b;
  19. return x;
  20. }
  21.  
  22. int main()
  23. {
  24. int a,b,n,i,x;
  25. cin>> n;
  26. int t[n];
  27. for(i=0;i<n;i++){
  28.         cin>> a >> b;
  29. x=NWW(a,b);
  30. t[i]=x/b;
  31. }
  32. for (i=0;i<n;i++){
  33.     cout<<t[i]<<endl;
  34. }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement