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.
1.in
containing
768 / 918you can pass it to your program in the bash like
$ cat in.txt | ./simplify 15 / 18
simplify.c
with your program.
This program will have to be simply compilable by calling clang simplify.c -o simplify
.