// Computes the odds of winning the lottery // in games where you draw 5 balls 1...69 or // somethings alongs those lines. import tio.*; public class LotteryOdds { public static void main(String[] args) { System.out.println("How many numbers do you need to draw?"); int numbers = Console.in.readInt(); System.out.println("What is the highest number you can draw?"); int topNumber = Console.in.readInt(); long oddsAre = 1; for (int i = 1; i <= numbers; i++) { oddsAre = oddsAre * topNumber / i; topNumber--; } System.out.println("Your odds are 1 in " + oddsAre + ". Good luck!"); } }