View Code of Problem 119

import java.util.*;

public class Main {
    public static boolean issu(int a) {
        if (a == 1) {
            return true;
        }else{
            for (int i = 2; i < Math.sqrt(a); i++) {
                if (a % i == 0) {
                    return false;
                }
            }
        }
        return true;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count=0;
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            if (issu(n)) {
                System.out.println("Case #" + (++count) + ": I'm richer than any one");
            } else {
                System.out.println("Case #" + (++count) + ": What a fxcking day");
            }
        }
    }
}

Double click to view unformatted code.


Back to problem 119