View Code of Problem 119

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

Double click to view unformatted code.


Back to problem 119