Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.text.DecimalFormat;
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class Demo {
  6.  
  7. static double mathPower(double number,int power){
  8. return Math.pow(number,power);
  9. }
  10. public static void main(String[] args) {
  11. Scanner scanner = new Scanner(System.in);
  12. double number = Double.parseDouble(scanner.nextLine());
  13. int power = Integer.parseInt(scanner.nextLine());
  14.  
  15. System.out.println(new DecimalFormat("0.####").format(mathPower(number,power)));
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement