0
Calculate square without using sqrt
2 Antworten
+ 3
Please tag the relevant programming language.
You can use exponent 0.5 to get the square root.
edit:
And please clarify if you calculate the square or the square root.
0
You should not use sqrt to calculate the square of a number because sqrt calculates square root.
To calculate the square, simply multiply the number by itself.
n = 5;
nsquared = n*n; // = 25