20.04.2014 Views

Notes for the lectures on FORTRAN Programming - Ingegneria ...

Notes for the lectures on FORTRAN Programming - Ingegneria ...

Notes for the lectures on FORTRAN Programming - Ingegneria ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

IF-Arithmetic<br />

statement<br />

• The following example transfers c<strong>on</strong>trol to statement 50 if <str<strong>on</strong>g>the</str<strong>on</strong>g> real r<br />

variable THETA<br />

is less than or equal to <str<strong>on</strong>g>the</str<strong>on</strong>g> real variable MU. C<strong>on</strong>trol passes to statement 100 <strong>on</strong>ly if<br />

THETA is greater than MU.<br />

IF (THETA-MU) 50,50,100<br />

• The following example transfers c<strong>on</strong>trol to statement 400 if <str<strong>on</strong>g>the</str<strong>on</strong>g> value of <str<strong>on</strong>g>the</str<strong>on</strong>g> integer<br />

variable N is even. It transfers c<strong>on</strong>trol to statement 200 if <str<strong>on</strong>g>the</str<strong>on</strong>g> value is odd.<br />

IF (N/2*2-N) N) 200,400,200<br />

• The following statement transfers c<strong>on</strong>trol to statement 100 <str<strong>on</strong>g>for</str<strong>on</strong>g> N5:<br />

IF (N-5) 100, 200, 300

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!