package test1; public class Answer { public static void main(String[] args) { // TODO Auto-generated method stub int count_happyday = 0; for(int month=1; month<13; month++){ //31日まである if((month == 1)||(month == 3)||(month == 5)||(month == 7)||(month == 8)||(month == 10)||(month == 12)){ for(int day10=1; day10<4; day10++){ for(int day1=1; day1<32; day1++){ if(month == day10 + day1){ count_happyday++; } } } } //28日まである if(month == 2){ for(int day10=1; day10<3; day10++){ for(int day1=1; day1<29; day1++){ if(month == day10 + day1){ count_happyday++; } } } } //30日まである if((month == 4)||(month == 6)||(month == 9)||(month == 11)){ for(int day10=1; day10<4; day10++){ for(int day1=1; day1<31; day1++){ if(month == day10 + day1){ count_happyday++; } } } } } System.out.print("happydayの数:" + count_happyday); } }