import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int count = 1; while(scanner.hasNext()) { int money = scanner.nextInt(); if(isSu(money)) { 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.