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.
-Wall -Werror -pedantic -std=c99 -O2
pub00.in
containing
2 / 4you can pass it to your program in the bash like
$ cat pub00.in | ./simplify 1 / 2
simplify.c
and either a Makefile or readme explaining how to compile it.