Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.hackerrank.com/challenges/30-more-exceptions/problem
- //Write your code here
- class Calculator{
- public int power(int a, int b){
- if(a < 0 || b < 0){
- throw new Exception("n and p should be non-negative");
- }
- return (int)Math.Pow(a, b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement