Masala #INB9WKTXVX
Mathematics 1
Write a program that generates a series of fraction simplification problems. Each problem consists of a fraction in the form a/b
, where a
and b
are randomly generated positive integers between 1 and 1000.
Your task is to simplify each fraction to its simplest form by dividing both the numerator and the denominator by their greatest common divisor (GCD).
Write a Python program that generates 100 fraction simplification problems.
The output file should contain a single line with the simplified fraction in the form c/d
, where c
and d
are the numerator and denominator of the simplified fraction obtained by dividing a
and b
by their GCD.
Ensure that the generated fractions are in their simplest form, i.e., the GCD of a
and b
is 1.
The input file should contain a single line with the fraction in the form a/b
.
The output file should contain a single line with the simplified fraction in the form c/d
, where c
and d
are the numerator and denominator of the simplified fraction obtained by dividing a
and b
by their GCD.
Ensure that the generated fractions are in their simplest form, i.e., the GCD of a
and b
is 1.
# | input.txt | output.txt |
---|---|---|
1 |
341/788 |
341/788 |
2 |
774/947 |
774/947 |