We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicintpower(intn,intp)throwsException{doubleresult;if(n<0||p<0){thrownewException("n and p should be non-negative");}else{result=Math.pow((double)n,(double)p);}return(int)result;}
Day 17: More Exceptions
You are viewing a single comment's thread. Return to all comments →
Here's mine: