题目:
编程输出1到100之间所有的偶(双)数。(这道题解法很多,要求大家尽可能用较少的步骤完成)
代码:
1 program work20161210_1; 2 var 3 i,j,s:integer; 4 BEGIN 5 for i:= 1 to 50 do 6 write(i*2,' '); 7 END.
1 program work20161210_2; 2 var 3 i,j,s:integer; 4 BEGIN 5 i:=2; 6 while i<= 100 do 7 begin 8 write(i,' '); 9 i:=i+2; 10 end; 11 END.
老师的答案: