Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,a,b,x,y;
- cin>>n;
- for (int i=1;i<=n;i++)
- {
- cin>>x>>y;
- a=x;
- b=y;
- while (b!=0)
- {
- int r=a%b;
- a=b;
- b=r;
- }
- x=x/a;
- y=y/a;
- int c2=0,c5=0;
- while (y%2==0)
- {
- c2++;
- y=y/2;
- }
- while (y%5==0)
- {
- c5++;
- y=y/5;
- }
- if (y==1) cout<<"fractie finita\n";
- else
- if (c2==0 && c5==0)
- cout<<"fractie periodica simpla\n";
- else cout<<"fractie periodica mixta\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement