View Code of Problem 119


import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int i = 1;
        while (scanner.hasNext()) {
            long n = scanner.nextLong();
            if (sushu(n)) {
                System.out.printf("Case #%d: I'm richer than any one\n", i);
            } else {
                System.out.printf("Case #%d: What a fxcking day\n", i);
            }
            i++;
        }
    }

    public static boolean sushu(long number) {
        boolean flag = true;
        for (int i = 2; i < Math.sqrt(number); i++) {
            if (number % i == 0) {
                flag = false;
                break;
            }
        }
        return flag;

    }
}

Double click to view unformatted code.


Back to problem 119