Write a program to enter a number from keyboard and display the same. this has to be repeated till you enter 'Y' or 'y 'yes as the choice of continuation.
Answers
Answer:
import java.util.Scanner;
class EnterAndPrint
{
public static void main(String args[])
{
Scanner Titan = new Scanner(System.in);
while(true)
{
System.out.println(“Do you want to continue?”);
System.out.println(“Enter Y or y for yes and anything else for no.”);
char a = Titan.next()charAt();
if (a == ‘Y’)
{
System.out.println(“Enter any number frothe keyboard.”);
int s = Titan.nextInt;
System.out.println(“Your number is ”+s”);
}
else if (a == ‘y’)
{
System.out.println(“Enter any number from the keyboard.”);
int s = Titan.nextInt;
System.out.println(“Your number is ”+s”);
}
else
{
System.out.println(“Thanks for using the program.”);
}
}
}
Hope it helped you...
Kindly Mark as Brainiest...