Simplify Fraction with Checks

PHP Medium 5 views
Back to Questions

Problem Description

Input a b meaning a/b. If b=0 print ERROR. Else print reduced fraction p q.

Input Format

One line: a b.

Output Format

p q or ERROR.

Sample Test Case

Input:
6 8
Output:
3 4

Constraints

|a|

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next