int max = input("偶数を探す上限値を入力してください。"); for (int i=0; i<=max; i++) { if ( (i%2) == 0 ) { println(i); } }