Finding Square Roots

QUESTION

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 .\n\nAssume 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.\nInput\n\nThe first line of the input contains an integer T, the number of test cases. T lines follow. Each T contains an integer N whose square root needs to be computed.\nOutput\n\nFor each line of input output the square root of the input integer.\nConstraints\n\n1<=T<=20\n1<=N<=10000

“TESTCASE_1”: “3\n10\n5\n10000\n###—###SEPERATOR—###—\n3\n2\n100”, “TESTCASE_2”: “1\n10\n###—###SEPERATOR—###—\n3”, “TESTCASE_3”: “1\n5\n###—###SEPERATOR—###—\n2”, “TESTCASE_4”: “0\n###—###SEPERATOR—###—\n0”, “TESTCASE_5”: “0\n###—###SEPERATOR—###—\n0

ANSWER

#include<stdio.h>
#include<math.h>
int main()
{
int t,num,sroot;
scanf("%d",&t);
while(t--)
{
	scanf("%d",&num);
	sroot = sqrt(num);
	printf("%d\n",sroot);
}
return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.