text: Write a program to calculate pow ( x , n ) | Java program for the above approach ; Math . pow ( ) is a function that return floating number ; Driver Code
code: import java . io . * ; class GFG { public static int power ( int x , int y ) { return ( int ) Math . pow ( x , y ) ; } public static void main ( String [ ] args ) { int x = 2 ; int y = 3 ; System . out . println ( power ( x , y ) ) ; } }