Integer square roots

The integer square root of a natural number xx is a natural number aa such that a2xa^2\le x but (a+1)2>x(a+1)^2>x. For instance, the integer square root of 100 is 10, and it is also of 120.

Write a program that reads natural numbers and prints their integer square roots. Your program must include the function

    int root (int x);

that returns the integer square root of a natural number x10000x\le10000.

Input

Input is a sequence of natural numbers.

Output

For each number xx of the output, print in a line and separated by a space, xx and its root.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:17:18.222Z

© Jutge.org, 2006–2026.
https://jutge.org