SHARE
TWEET

Untitled

a guest Jan 26th, 2020 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int cmmdc(int a, int b)
  4. {
  5.     if(b==0) return a;
  6.     return cmmdc(b , a%b);
  7. }
  8. int main()
  9. {
  10.     int n;
  11.     cin>>n;
  12.     for(int i=1;i<=n;i++)
  13.     {
  14.         int a,b,c=0;
  15.         cin>>a>>b;
  16.         int m=b/cmmdc(a,b);
  17.         while(m%2==0) {m=m/2; c++;}
  18.         while(m%5==0) {m=m/5; c++;}
  19.         if(m==1) cout<<"fractie finita"<<"\n";
  20.         else if(c==0) cout<<"fractie periodica simpla"<<"\n";
  21.         else if(c>0)cout<<"fractie periodica mixta"<<"\n";
  22.     }
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top