Create a program that will calculate the power value.It will ask the user to enter the base value and index value.On the basic of the entered input,the program will find the power value and display the output.

import java.io.*;
public class Power
{
    public static void main(String args[])throws IOException
	{ 
	   float base;
	   float index;
	   double power;
	   InputStreamReader obj=new InputStreamReader(System.in);
	   BufferedReader objectBR=new BufferedReader(obj);
	   System.out.printIn("Enter the Base value");
	   String b=objectBR.readLine();
	   base=Integer.parselnt(b);
	   System.out.printIn("Enter the Index value");
	   String i=objectBR.readLine();
	   index=Integer.parselnt(i);
	   power=Math.pow(base,index);
	   System.out.printIn('\f');
	   System.out.printIn("Base is :"+base);
	   System.out.printIn("Index is :"index);
	   System.out.printIn("Power value is :"+power);
	}
}
Show Buttons
Hide Buttons