OneCompiler

GAMBLE using "random" method

160

import java.util.*;

public class HelloWorld {
public static void main(String[] args) {
Double b;
int e = 4;
System.out.println("Enter a number from 0 - 9");
/* Scanner s = new Scanner(System.in);
int c = s.nextInt();
System.out.println(c);*/
System.out.println("Entered number= "+ e);
b= Math.random()*10;
int d = (int)Math.round(b);
//System.out.println(d);
if(e==d)
System.out.println("You won this round");
else
System.out.println("you loose");
}
}