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 :
Sample Output 1 :
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
Post a Comment