next up previous contents
Next: Sample Program 5b Up: 繰り返し、二つ以上の条件式 Previous: 二つ以上の条件を課す   Contents

Sample Program 5a

サンプルプログラム5は、複数の条件を論理演算子でつなぎ合わせた複合的な条件のもとで、 場合分けを行う演習です。
\begin{code}
100 for i=1 to 8
110 read x
120 if x=>50 and x<80 then print x
130 next i
140 data 85,66,58,61,79,93,84,100
990 end
\end{code}
ここでは、xが50以上、且つ80未満である場合のみ印字します。



Takeyoshi Nagai 2013-10-07