[Python] What other ways could be of representing an irreducible fraction without gcd? [closed]

Discussão em 'Python' iniciado por Stack, Março 13, 2025.

  1. Stack

    Stack Membro Participativo

    My code for it:

    from math import gcd

    y = int(input())
    w = int(input())

    g = gcd(y, w)
    print(f"{y// g}/{w// g}")


    Could there be any other way of solving this problem without using gcd?

    I tried thinking of ways. Creating maybe some kind of relation of numerator and denominator that could work as a formula but it wouldn't work for all numbers.

    Continue reading...

Compartilhe esta Página