SQUARE ROOT
Problem Description
Nehas task is to find a square root for a number. Guide Neha by writing a c program in finding a square root of a number.
Input:
Input should contain a valid integer number.
Output:
Should display the square root value of a number
Input Method
Integer ranges from 1 to 999
Output Method
sum of digits of the number
CODING ARENA::
#include <stdio.h>
#include<math.h>
int main()
{
int a,b;
scanf("%d",&a);
b=sqrt(a);
printf("%d",b);
return 0;
}
Test Case 1
Input (stdin)4
Expected Output
2
Test Case 2
Input (stdin)100
Expected Output
10
Given an integer x, Your task is to find the square root of it. If x is not a perfect square, then return floor(√x).
ReplyDeleteInput Format:
The first line of input contains the number of test cases T. For each test case, the only line contains the number x.
Output Format:
For each test case, print the square root of the given integer.
User Task:
The task is to complete the function floor sort() which should return the square root of given number x.
Constraints:
1 ≤ T ≤ 1000
1 ≤ N ≤ 1000000
TEST CASE 1
INPUT
2
5
4
OUTPUT
2
2
TEST CASE 2
INPUT
1
81
OUTPUT
9