Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // нахождение корня n степени из числа
- #include <iostream>
- #include <cmath>
- using namespace std;
- double const eps = 0.000001;
- int main()
- {
- double l = 0, r, a, n, m = 0;
- cin >> a >> n;
- r = a;
- while (r - l > eps)
- {
- m = (double)(l + r) / 2;
- if (pow(m, n) > a) r = m ;
- else l = m ;
- }
- cout << m;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement