Integer square roots

The integer square root of a natural number x is a natural number a such
that a² ≤ x but (a + 1)² > 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 x ≤ 10000.

Input

Input is a sequence of natural numbers.

Output

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

Problem information

Author: Unknown
Translator: Carlos Molina

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

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