package com.apcs;
public class Main {
public static void main(String[] args) {
int doorCount = 4, never = 0, runs = 1000000;
for (int k = 0; k < runs; k++) if ((int)(Math.random()*doorCount) == (int)(Math.random()*doorCount)) never++;
System.out.println("Using " + doorCount + " doors.\n" + "After " + runs + " runs, not switching succeeds " + (never*100.0/runs) + "% of the time.\n" + "After " + runs + " runs, switching succeeds " + (100 - (never*100/runs)) + "% of the time.");