module pind.samples.ja.arrays.arrays_2; import std.stdio; void main() { // 2月は28日あると仮定する int[12] monthDays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; write("Please enter the number of the month: "); int monthNumber; readf(" %s", &monthNumber); int index = monthNumber - 1; writeln("Month ", monthNumber, " has ", monthDays[index], " days."); }