<Example Program 1>
| Program if_construct_example_1 Integer x Read *, x If (Mod(x,2)==0) Then Print *, 'even',x Else If (x<0) Then Print *, 'odd negative',x End If End |
|
Example Input 14 Execution Resultseven 4 |
|
Example Input 2-7 Execution Resultsodd negative -7 |
|
<Example Program 2>
| Program if_construct_example_2 Integer x Read *, x eventest: If (Mod(x,2)==0) Then Print *, 'even' If (x==4) Then Print *, 'four' End If End If eventest End |
|
Example Input 12 Execution Resultseven |
|
Example Input 24 Execution Resultseven four |
|