Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class Demo {
- static double mathPower(double number,int power){
- return Math.pow(number,power);
- }
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double number = Double.parseDouble(scanner.nextLine());
- int power = Integer.parseInt(scanner.nextLine());
- System.out.println(new DecimalFormat("0.####").format(mathPower(number,power)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement