こんにちは皆さん、私は Java の初心者で、英語が苦手です。私の問題を理解していただければ幸いです。
public static void main(String[] args) {
int i, a, b, c, d, yil = 1999, rt = 0;
do{
//loop searching for 1976
for( i = 1900; i < 2000; i++){
//separate "i" to the digits
a = i / 1000;
b = i % 1000 / 100;
c = i % 1000 % 100 / 10;
d = i % 1000 % 100 % 10;
rt = a + b + c + d;
}}
//while rt=23 and i=1976 equation will be correct then exit the loop and print the 1976.
while( rt == yil - i );
System.out.println("Yıl = " + i );
}
しかし、プログラムを実行すると、常に 1976 ではなく 2000 と表示されます。