Wednesday, July 19, 2017

Exponent Program

/*
A program that displays the value of a number raised to the power of a number.Created by Eyasu Mulugeta A.K.A BlackDiamond0014 on 6/23/2017.
eyasu@india.com
*/
import java.util.Scanner;
import static java.lang.Math.pow;

public class ExponentProgram {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        double base, exponent;
        System.out.print("Enter the base : ");
        base=in.nextDouble();
        System.out.println();
        System.out.print("Enter the exponent : ");
        exponent=in.nextDouble();

        System.out.println("\n"+base+" raised to "+exponent+" is "+
                pow(base,exponent));
    }
}

Share: