+ 2
Challenge: approximate square root
The easy way for approximately finding the square root of a given positive integer x is: 1. find y, with x = y*y +c 2. solve sqrt(x) = y + c/(2*y) (x, y, c are positive integers) Write program for finding square root of a given integer with this method (please don't use standard methods, like pow(.,.), or Math.pow and so on...). if you get bored, you can find the integer between 1 and 100 that has the biggest difference between "real" square root (computed with e.g. Math.pow(x,0.5)) and the square
1 Odpowiedź