mercredi 20 avril 2016

Adding Random Numbers

Im new to Java coding and im trying to make a math game. I'm trying to add 2 random numbers (1-10) and the result has to be a positive number and no decimals. Here is what I have come up with. It wont work and I'm not sure what to do.

public class MathGame {
    public static void main(String[] args) {
           int Low = 1;
           int High = 10;
           Random r = new Random();
       int Result = r.nextInt(High-Low) + Low;
    }
}



Aucun commentaire:

Enregistrer un commentaire