2021-10-27

Write a program to take numbers as input and return the first number raised to the power of the second number.

Sample Input
2
4

Sample Output
16.0

import java.util.Scanner;

class Main {
   public static void main(String[] args) {
       Scanner read = new Scanner(System.in);
       int num1 = read.nextInt();
       int num2 = read.nextInt();

       //code goes here
       
       double p = Math.pow(num1, 
      num2);
      System.out.println(p);
   }
}
上一篇:C语言计算日期天数差


下一篇:列表初始化和赋值初始化的使用注意事项