Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double power(double x,int n)
- {
- if (n == 0)
- return 1.0;
- if(x == 0)
- {
- printf("Invalid Base: '0' ");
- return 1;
- }
- if(n < 0)
- {
- x = 1.0/x;
- n = -n;
- }
- demand(n>0, power failed);
- return power2(x, n);
- }
Add Comment
Please, Sign In to add comment