public class NoMod { public static void main1(String[] args) { int num = Integer.parseInt(args[0]); int den = Integer.parseInt(args[1]); int div = num / den; // this will round down so 5/2 = 2 int mul = div * den; int modu = num - mul; System.out.println("The remainder of " + num + "/" + den + " is " + modu); } public static void main2(String[] args) { int count = 0; int drawn = 0; while (drawn < 90) { count++; drawn = (int) (Math.random() * (100 - 20 + 1) + 20); // to get a number in the range 20-100 including both 20 and 100 you need 81 possibilities, not just 80 } System.out.println(count); } public static void main3(String[] args) { for (int i = 0; i <= 100; i++) { if (i % 3 == 0 && i % 5 == 0) { System.out.println("Fizz Buzz"); } else if (i % 3 == 0) { System.out.println("Fizz"); } else if (i % 5 == 0) { System.out.println("Buzz"); } else { System.out.println(i); } } } public static void main4(String[] args) { Integer num = Integer.parseInt(args[0]); boolean isPrime = true; // start by assuming the number is prime for (int i = 2; i < num; i++) { if (num % i == 0) { isPrime = false; } } if (isPrime) { System.out.println(num + " is prime"); } else { System.out.println(num + " is NOT prime"); } } public static void main(String[] args) { Integer num = Integer.parseInt(args[0]); for (int j = 2; j < num; j++) { boolean isPrime = true; // start by assuming the number is prime for (int i = 2; i < j; i++) { if (j % i == 0) { isPrime = false; } } if (isPrime) { System.out.println(j); } } } }