import java.util.Scanner;
public class power_number
{
public static Scanner sayed;
public static void main(String[] args)
{
int base,exp;
sayed=new Scanner (System.in);
System.out.println("Enter the number and power:");
base=sayed.nextInt();
exp=sayed.nextInt();
System.out.print(result(base,exp));
}
public static double result(int base, int exp)
{
System.out.print(""+base+" to the power "+exp+" = ");
return Math.pow(base,exp);
}
}
No comments:
Post a Comment