Lucian_Adrian

#112 FractieMinima

Nov 2nd, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n,x,max=-1,min=999999999,a,b,r,d;
  6. cin>>x;
  7. for(int i=1;i<=x;i++)
  8. {
  9. cin>>n;
  10. if(n<min) min=n;
  11. if(n>max) max=n;
  12. }
  13. a=max;
  14. b=min;
  15. while(b!=0)
  16. {
  17. r=a%b;
  18. a=b;
  19. b=r;
  20. }
  21. d=a;
  22. cout<<min/d<<"/"<<max/d;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment