-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFinding Square Roots
28 lines (24 loc) · 1.09 KB
/
Finding Square Roots
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Finding Square Roots
Problem
In olden days finding square roots seemed to be difficult but nowadays it can be easily done using in-built functions available across many languages .
Assume that you happen to hear the above words and you want to give a try in finding the square root of any given integer using in-built functions. So here's your chance.
Input
The first line of the input contains an integer T, the number of test cases. T lines follow. Each line contains an integer N whose square root needs to be computed.
// We have populated the solutions for the 10 easiest problems for your support.
// Click on the SUBMIT button to make a submission to this problem.
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner input = new Scanner(System.in);
int cases = input.nextInt();
for (int i = 0 ; i < cases; i++){
int n = input.nextInt();
System.out.println((int)Math.sqrt(n));
}
}
}