Search
Write a simple program that:
Hint: take a look at the GCD and find an algorithm to compute it.
Some examples of the program behaviour when called as ./simplify. The first line is the input, the second is output.
$ ./simplify 2 / 4 1 / 2
$ ./simplify 765 / 918 5 / 6
$ ./simplify 101 / 100 101 / 100
You can find more testing instances here. Files with the suffix .in contain your input with .out your desired output.
.in
.out
1.in
768 / 918
$ cat in.txt | ./simplify 15 / 18
simplify.c
clang simplify.c -o simplify