राइट ए प्रोग्राम टू फाइंड द स्क्वायर एंड क्यूब ऑफ द नंबर
Answers
Answered by
0
Answer:
by using binary search...we can find square root of a y number..
Using Binary Search: This approach is used to find the square root of the given number N with precision upto 5 decimal places.
The square root of number N lies in range 0 ≤ squareRoot ≤ N. Initialize start = and end = number.
Compare the square of the mid integer with the given number. If it is equal to the number, then we found our integral part, else look for the same in the left or right side of mid depending upon the condition.
After finding an integral part, we will find the fractional part.
Initialize the increment variable by 0.1 and iteratively calculate the fractional part upto 5 decimal places.
For each iteration, change increment to 1/10th of its previous value.
Finally, return the answer computed
Step-by-step explanation:
hope this will help you..
Similar questions
English,
3 months ago
Social Sciences,
3 months ago
Economy,
7 months ago
Math,
7 months ago
Biology,
11 months ago