Search
Write a simple program that:
Hint: 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, and the second is the 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
-Wall -Werror -pedantic -std=c99 -O2
pub00.in
2 / 4
$ cat pub00.in | ./simplify 1 / 2
simplify.c