Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,x,max=-1,min=999999999,a,b,r,d;
- cin>>x;
- for(int i=1;i<=x;i++)
- {
- cin>>n;
- if(n<min) min=n;
- if(n>max) max=n;
- }
- a=max;
- b=min;
- while(b!=0)
- {
- r=a%b;
- a=b;
- b=r;
- }
- d=a;
- cout<<min/d<<"/"<<max/d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment