daily pastebin goal
25%
SHARE
TWEET

08. Math Power

a guest Feb 22nd, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4. public class MathPower {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.  
  8.         double number = Double.parseDouble(scanner.nextLine());
  9.         int power = Integer.parseInt(scanner.nextLine());
  10.  
  11.         DecimalFormat format = new DecimalFormat("#.############");
  12.  
  13.         System.out.print(format.format(mathPower(number, power)));
  14.     }
  15.  
  16.     static Double mathPower (double number, int power){
  17.         double result = Math.pow(number, power);
  18.         return result;
  19.     }
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top