Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- //cin>>n;
- double a=0;
- double b=3;
- double x=2;
- while ((b-a)>0.00001){
- double c=(a+b)/2;
- if ((c*c)>x){
- b=c;
- }
- else if ((c*c)<x){
- a=c;
- cout << c<< endl;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement