GUESS THE NUMBER AGAINST RANDOM NUMBER GENERATED BY COMPUTER

//GUESS THE NUMBER AGAINST RANDOM NUMBER GENERATED BY COMPUTER.
import java.util.*;
public class RandomNum
{
public static void main(String args[])
{
int rnd,a;
rnd=(int)(10*Math.random());
Scanner in = new Scanner(System.in);
System.out.println(“Enter the number”);
a = in.nextInt();

if(a==rnd)
System.out.println(“congrats you won!!”);
else
System.out.println(“Try again u entered:”+a);
System.out.println(“and the number is genrated:”+rnd);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *