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