import java.util.Scanner;
public class Test3
{
public static void main(String args[])
{
//creation of random no.
Scanner s1 = new Scanner(System.in);
int number; // user input
int random; // random variable
System.out.println("Enter '1' to play the game");
number= s1.nextInt();
do
{
if(number==1)
{
random= (int)(Math.random()*109);
System.out.println("Your Random number is"+random);
}
else
{
System.out.println("invalid");
}
System.out.println("Do you wanna continue...enter '1' otherwise enter '0' ");
number= s1.nextInt();
}while(number==1);
System.out.println("Thanks for playing the game");
}
}
Comments
Post a Comment