Write a program for finding the root of any positive integer N using c++. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Write a program for finding the root of any positive integer N using c++.

One way of finding the square root of any positive integer N is by using the formula; X(new)=1/2 (X(old)+N/X(old)) Where X(new) gives an improved square root of N. The initial value of X(old) can be any guessed number. The current X(old) when substituted into X(new) gives a better estimate that becomes the next iteration of X(old). When the absolute difference of X(new) and X(old) is less than 10^-6 , then X(new) is considered to be root of N. Write a program for the above process in finding the root of any positive integer N.

22nd Feb 2019, 12:49 PM
Franklin Yaw Frimpong
Franklin Yaw Frimpong - avatar
1 Answer
+ 2
Franklin Yaw Frimpong It seems your question appears to be an assignment. Please show us your attempt and use the 8 rules to get help from the community. https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community *can be a code coach solution which is meant for you to do to help you establish your skills abilities and where you need to learn... not the community *one issued by a school or other institution *one issued or created by another platform *one that appears to be in the form of a challenge that was created by you or somewhere else. Your question will be reviewed by a team of moderators and will most likely be marked for deletion. https://www.sololearn.com/Discuss/1316935/?ref=app
26th Jan 2021, 6:02 PM
BroFar
BroFar - avatar