Advertisement
happynihilist888

Untitled

Feb 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include<iostream>
  2. #include<climits>
  3. using namespace std;
  4. int main()
  5. {
  6. int maxim,minim,d,x,n,i,r=0,aux1,aux2,M=0,a,b;
  7. cin>>n;
  8. maxim=INT_MIN;
  9. minim=INT_MAX;
  10. for(i=1;i<=n;i++)
  11. {
  12. cin>>x;
  13. if(x>maxim)
  14. {
  15. maxim=x;
  16. }
  17. if(x<minim)
  18. {
  19. minim=x;
  20. }
  21. aux1=maxim;
  22. aux2=minim;
  23. while(aux2!=0)
  24. {
  25. r=aux1%aux2;
  26. aux1=aux2;
  27. aux2=r;
  28. }
  29.  
  30. }
  31. a=maxim/aux1;
  32. b=minim/aux1;
  33. cout<<b<<"/"<<a;
  34. return 0;
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement