Square Root

 

Given a number N, find its square root. You need to find and print only the integral part of square root of N.

Sample Input 1 :
10
Sample Output 1 :
3

import java.util.Scanner;

public class SquareRoot {

public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n= s.nextInt();
int op=0;
while(op*op<=n)
{
op++;
}
op--;
System.out.println(op);
}

}

Comments

Popular posts from this blog

Minimum Length Word

Check Number Sequence

Star Pattern