Your logic was correct but you have made an error in your program.
The statement,i = in.nextInt();should be inside the do-while loop.
import java.util.Scanner;
public class twelve{
public...
Type: Posts; User: Karthik Prabhu
Your logic was correct but you have made an error in your program.
The statement,i = in.nextInt();should be inside the do-while loop.
import java.util.Scanner;
public class twelve{
public...