以下のプログラムとなります。
繰り返しているところをfor文でまとめるという発想で変更を行っています。
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | class MoreChallengeSection7 {   public static void main(String[] args) {     int a = 0;     int b = 1;     int c = 0;     System.out.println(a);     System.out.println(b);     c = b + a;     System.out.println(c);     for(int i = 0; i < 17; i++) {       a = b;       b = c;       c = b + a;       System.out.println(c);     }   }  } | 
 
		 
						
最近のコメント