Thursday, February 12, 2015

Sum Of Two Dice java in program



SumOfTwoDice.java

public class SumOfTwoDice
 { 
    public static void main(String[] args) 
{
        int SIDES = 6;
        int a = 1 + (int) (Math.random() * SIDES);
        int b = 1 + (int) (Math.random() * SIDES);
        int sum = a + b;
        System.out.println(sum);
    }
}

1 comment: