Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Problem of the day

You are given a real number, 'NUM'. You have to represent this number as an irreducible fraction of the form A/B, where 'A' and 'B' are the numerator and denominator respectively.

A fraction is called irreducible when the greatest common divisor (GCD/HCF) of the numerator and denominator is one.

```
Given 'NUM' : 1.75
Irreducible fraction can be represented as 7/4.
Note that 14/8 = 1.75 as well, but 14/8 is not an irreducible fraction.
```

```
In order to preserve precision, the real number will be given to you in the form of two strings : the integer part, and the fractional part.
The integer part will contain not more than 8 digits, whereas the fractional part will always contain 8 digits.
```

Detailed explanation

```
1 <= T <= 10^5
0 < NUM < 10^8
Time Limit : 1 sec
```

```
2
1 75000000
20 20000000
```

```
7 4
101 5
```

```
Test case 1 :
7/4 = 1.75
Test case 2 :
101/5 = 20.2
202/10 is also equal to 20.2 but it is not an irreducible fraction.
```

```
2
0 36000000
0 00000001
```

```
9 25
1 100000000
```