Or login with:
| template<class T> Tnroot( | const T& | x | |
| const T& | n | ) |
#include <stdio.h> using namespace Maths::Arithmetic; int main() { for(double x = 10; x <= 100; x += 10) //to resolve pow ambiguities { for(int y = 2; y < 5; y++) printf("The %d root of %.0f is %lf\n", y, x, nroot(x,y)); } return 0; }
The 2 root of 10 is 3.162278 The 3 root of 10 is 2.154435 The 4 root of 10 is 2.632547 The 2 root of 20 is 4.472136 The 3 root of 20 is 2.714418 The 4 root of 20 is 2.114743 The 2 root of 30 is 5.477226 The 3 root of 30 is 3.107233 The 4 root of 30 is 2.340347 The 2 root of 40 is 6.324555 The 3 root of 40 is 3.419952 The 4 root of 40 is 2.514867 The 2 root of 50 is 7.071068 The 3 root of 50 is 3.684031 The 4 root of 50 is 2.659148 The 2 root of 60 is 7.745967 The 3 root of 60 is 3.914868 The 4 root of 60 is 2.783158 The 2 root of 70 is 8.366600 The 3 root of 70 is 4.121285 The 4 root of 70 is 2.892508 The 2 root of 80 is 8.944272 The 3 root of 80 is 4.308869 The 4 root of 80 is 2.990698 The 2 root of 90 is 9.486833 The 3 root of 90 is 4.481405 The 4 root of 90 is 3.080070 The 2 root of 100 is 10.000000 The 3 root of 100 is 4.641589 The 4 root of 100 is 3.162278
| x | a number |
| n | the root required |
Source code is available when you agree to a GP Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.
You must login to leave a messge