import java.util.*;
public class oddNumbers
{
public static void main(String[] args)
{
System.out.println("enter two number");
Scanner kb=new Scanner( System.in);
int number=kb.nextInt();
int number2=kb.nextInt();
do{
if(number%2!=0) {
System.out.println(number);
}
number++;
} while( number< number2);
}
}
Heading
I want to know how to ask the user if he/she wants to continue using this program or terminate it, and them this program has to do what the user wants to do. I have use the do while loop for this task.
Simply put your code within another do while loop.
Here is your solution