这是代码:
class Fibonacci {
static final int MIN_INDEX = 1;
public static void main (String[] args){
int high = 1;
int low = 1;
String jel;
System.out.println("9: " + high);
for (int i = 8; i >= MIN_INDEX; i--){
if (high % 2 == 0)
jel = " *";
else
jel = " ";
System.out.println(i + ": " + high + jel);
high = low + high;
low = high - low;
}
}
}
我想制作这个程序,向后写输出数字。所以我不仅想要从最后一个到第一个的“i”步骤,还想要数字。
在此示例中,输出为: 1, 1, 2, 3, 5, 8 , eg... 但我想按如下顺序显示它: eg... , 8, 5, 3, 2, 1 , 1.
我试图改变高低,但我不能让这个程序强制“向后”运行。