Integer roots P63448


Statement
 

pdf   zip

thehtml

The integer square root of a natural number x is a natural number a such that a2x but (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 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.

Public test cases
  • Input

    100
    120
    121
    225
    226
    

    Output

    100 10
    120 10
    121 11
    225 15
    226 15
    
  • Information
    Author
    Jordi Petit
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python