Sort by

recency

|

629 Discussions

|

  • + 0 comments
    import java.util.*;
    
    class Calculator{
        int power(int n, int p) {
            if (n < 0 || p < 0) {
                throw new IllegalArgumentException("n and p should be non-negative");
            }
            return (int) Math.pow(n, p);
        }
    }
    
    class Solution{
        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            int t = in.nextInt();
            
            while (t-- > 0) {
                int n = in.nextInt();
                int p = in.nextInt();
                Calculator myCalculator = new Calculator();
                try {
                    int ans = myCalculator.power(n, p);
                    System.out.println(ans);
                }
                catch (Exception e) {
                    System.out.println(e.getMessage());
                }
            }
            
            in.close();
        }
    }
    
  • + 0 comments

    Python code:

    class Calculator:

    def __init__(self):
         pass
    
    def power(self,n, p):
        if n < 0 or p < 0:
            raise Exception("n and p should be non-negative")
    
        return n ** p  
    
  • + 0 comments

    BEST CRYPT-O RECOVERY SERVICES/COMPANY**

    After losing crypt-ocurrency to a sca-m, I turned to ZEUS Crypt0 Recovery Services. Their team was professional, prompt, and effective, successfully recovering my funds in just weeks. I highly recommend their services.

    Conta-ct:

    Mail-Box: support @ zeusrecoveryservices . c o m

  • + 0 comments

    BEST CRYPT-O RECOVERY SERVICES/COMPANY**

    After losing crypt-ocurrency to a sca-m, I turned to ZEUS Crypt0 Recovery Services. Their team was professional, prompt, and effective, successfully recovering my funds in just weeks. I highly recommend their services.

    Conta-ct:

    Mail-Box: support @ zeusrecoveryservices . c o m

  • + 0 comments

    Here is problem solution in python, java, c++, C and javascript - https://programmingoneonone.com/hackerrank-day-17-more-exceptions-30-days-of-code-solution.html