public class Sample01 { public static void main(String[] args) { int[] lastDay = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int cnt = 0; int i = 0; int j = 0; for(i = 0; i < 12; i++){ for(j = 1; j <= lastDay[i]; j++){ if(i == j / 10 + j % 10){ cnt++; } } } System.out.println(cnt); } }