02.05.2014 Views

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

Patrick Corde & Anne Fouilloux

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Fonctions 157<br />

Exemple<br />

REAL, DIMENSION(100) :: tab<br />

REAL<br />

:: moyenne, maximum<br />

REAL<br />

:: maxi<br />

...<br />

maximum = maxi( tab, moyenne )<br />

PRINT *,moyenne, maximum<br />

...<br />

END<br />

FUNCTION maxi( t, moy )<br />

REAL, DIMENSION(100) :: t<br />

REAL<br />

:: moy, maxi<br />

INTEGER<br />

:: i<br />

maxi = t(1); moy = t(1)<br />

DO i=2,100<br />

IF ( t(i) > maxi ) maxi = t(i)<br />

moy = moy + t(i)<br />

END DO<br />

moy = moy/100<br />

END FUNCTION maxi<br />

INSTITUT DU DÉVELOPPEMENT<br />

ET DES RESSOURCES<br />

EN INFORMATIQUE SCIENTIFIQUE<br />

Cours langage Fortran – 27 janvier 2006<br />

<strong>Patrick</strong> <strong>Corde</strong> et <strong>Anne</strong> <strong>Fouilloux</strong>

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

Saved successfully!

Ooh no, something went wrong!