Advertisement
Guest User

mathPower

a guest
Oct 23rd, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.56 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4. public class mathPower {
  5.     public static void main(String[] args) {
  6.         Scanner console = new Scanner(System.in);
  7.  
  8.         double num1 = Integer.parseInt(console.nextLine());
  9.         int num2 = Integer.parseInt(console.nextLine());
  10.  
  11.         DecimalFormat df = new DecimalFormat("#.#######################");
  12.         System.out.println(df.format(powerNumber(num1, num2)));
  13.  
  14.     }
  15.  
  16.     private static double powerNumber(double num1, int num2) {
  17.         return Math.pow(num1, num2);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement