FastPrepFastPrep
Problem Brief

Find Reciprocal

OA

Given an integer, find its reciprocal. The reciprocal will end in infinitely recurring digits. Print the recurrence twice with a space between the first and second repetition.

For example, if N = 8, its reciprocal is 1/8 = 0.12500000..., so print 0.1250 0. If N = 9, its reciprocal is 1/9 = 0.111111..., so print 0.1 1.

Function Description

Complete the function findReciprocal in the editor.

findReciprocal has the following parameter:

  1. int N: the integer to find the reciprocal of

Returns

String: the recurrence of the reciprocal printed twice with a space between the repetitions

1Example 1

Input
N = 8
Output
"0.1250 0"
Explanation

The reciprocal of 8 is 1/8 = 0.12500000..., so the output is 0.1250 0.

2Example 2

Input
N = 9
Output
"0.1 1"
Explanation

The reciprocal of 9 is 1/9 = 0.111111..., so the output is 0.1 1.

Constraints

Limits and guarantees your solution can rely on.

2 ≤ N ≤ 10^5

public String findReciprocal(int N) {
  // write your code here
}
Input

N

8

Output

"0.1250 0"

Sign in to submit your solution.