1 / 29

FORTRAN 90

FORTRAN 90. An introduction to programming in Fortran 90 http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/fortran.html. FORmula TRANslation. Program structure. A FORTRAN 90 program has 4 main elements. 1. Program name. Program structure. Comments. Continuation Lines.

jbuttars
Download Presentation

FORTRAN 90

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FORTRAN 90 An introduction to programming in Fortran 90 http://www.cs.mtu.edu/~shene/COURSES/cs201/NOTES/fortran.html FORmula TRANslation

  2. Program structure A FORTRAN 90 program has 4 main elements.

  3. 1. Program name Program structure

  4. Comments

  5. Continuation Lines

  6. 2. Specification part 1. Constants have fix value 2. Variables may change value during execution of program Data types: 1. INTEGER 2. REAL 3. DOUBLE PRECISION 4. CHARACTER 4. LOGICAL 5. COMPLEX Program structure

  7. Data types: Constants, Variables • INTEGER • REAl • DOUBLE PRECISION • CHARACTER • LOGICAL • COMPLEX

  8. Constants PARAMETER Program structure

  9. Variables IMPLICIT NONE Program structure

  10. Variables IMPLICIT NONE Program structure

  11. Converting between types of variable • dbl transform a variable to double precision • Int truncate a real number to an integer • nint round a real number to the nearest integer x = i/j x = real(i) / real (j)

  12. Variable Initialization

  13. Initialization Variable Initialization

  14. Assignment Variable Initialization

  15. Arithmetic operator Variable Initialization

  16. Input - READ READ (*,*) list Variable Initialization

  17. Input - READ Variable Initialization

  18. 2. Execution part Program structure

  19. Functions

  20. Functions

  21. Functions

  22. WRITE WRITE (*,*) list

  23. Example WRITE

  24. Complete Example

  25. Complete Example

  26. Complete Example

  27. Complete Example

  28. Simple Example PROGRAM test IMPLICIT NONE REAL :: num1, num2, sum WRITE (*,*) "please neter two real number" READ(*,*) num1, num2 sum = num1 + num2 WRITE (*,*) "sum of two number is", sum END PROGRAM test

More Related