Using the knowledge in computational language in JAVA it is possible to write a code that function for the following statements: Java do-while Use Java do-while loop format.
import java.util.*;
public class Main
{
//recuresive function for calculate x^n
public static int pow(int x,int n){
if(n==0)
return 1;
else
return x*pow(x,n-1);
}
public static void main(String[] args) {
//scanner for taking input
Scanner sc=new Scanner(System.in);
//infinite loop stop when user enter Y in last
while(true){
System.out.print("Enter x: ");
int x=sc.nextInt();
System.out.print("Enter n : ");
int n=sc.nextInt();
System.out.printf("pow(%d,%d) :%d",x,n,pow(x,n));
char c;
System.out.print("\nYou Want to Continue(Y/N): ");
c=sc.next().charAt(0);
if(c=='Y'){
break;
}
}
}
}
See more about JAVA at brainly.com/question/18502436
#SPJ1