[PDF] Fortran 90 Basics





Previous PDF Next PDF



Programming Basics - FORTRAN 77

This is called the source code. The text has to follow certain rules (syntax) to be a valid FORTRAN program. We start by looking at a simple example:.



Fortran 90 Basics

?A Fortran 90 program has the following form: ?A Fortran 90 constant may be an integer real



Programming with Fortran.pdf

If the. 'integer expression' is not equal to any integer between 1 and k the statement is not executed. In the example



Fortran 90 Subprograms

Function Syntax: 1/3. ?A Fortran function or function subprogram



Appendix C - A Fortran Primer: (and cheat sheet)

with implicit none and declare every variable. It's annoying but it keeps you honest. I will try to do this in my programs. A sample program declara-.



OpenMP-4.0-Fortran.pdf

03-Feb-2014 OpenMP API 4.0 Fortran. Page 1. OpenMP 4.0 API Fortran Syntax Quick Reference Card. Fortran. OpenMP Application Program Interface (API) is.



Parallel Programming in Fortran 95 using OpenMP

OpenMP consolidates all this into a single syntax and semantics and finally For example if 10 threads are in use



Chapter 1: Fortran Programming: Detailed Notes

be read in conjunction with the example programs. First of all how is a simple FORTRAN program structured? ... Basic Syntax for the Three Types.



A Fortran 2003 introduction by examples

The Fortran 95 syntax for the declaration of a derived datatype can be lijke the one shown here. TYPE derived ! Internal variables. INTEGER. :: counter. REAL.



A Fortran Tutorial

The text has to follow a certain syntax to be a valid. Fortran program. We start by looking at a simple example where we calculate the area of a circle:.

Fortran 90 BasicsFortran

90

Basics

I don t know what the programming language I don t know what the programming language of the year 2000 will look like, but I know it will be called FORTRAN. 1

Charles Anthony Richard Hoare

Fall 2010

F90 Program StructureF90

Program

Structure

A Fortran 90 program has the following form:A

Fortran

90
program has the following form: program-nameis the name of that program specification part execution part and specification part execution part and subprogram-partare optional.

Althou

g h IMPLICIT NONEis also o p tional this is g p, required in this course to write safe programs.

PROGRAMprogram-name

IMPLICIT NONE[

ifi ti t spec ifi ca ti on- p ar t [execution-part] subprogram part 2 subprogram part

END PROGRAMprogram-name

Program CommentsProgram

Comments

Comments start with a

Comments

start with a

Everything following !will be ignored

This is similar to

in C/C++ This is similar to in C/C++ ! This is an example!

PROGRAM Comment

READ(*,*) Year ! read in the value of Year.......... .......... Year = Year + 1 ! add 1 to Year

END PROGRAM Comment

3

END PROGRAM Comment

Continuation LinesContinuation

Lines

Fortran 90 is not completely format

free!

Fortran

90
is not completely format free!

A statement must starts with a new line.

If t t t i t l t fit li it h

If a s t a t emen t i s t oo l ong t o fit on one li ne, it h as to be continued.

The continuation character is &, which is not

part of the statement.

Total = Total + &

Amount * Payments! Total = Total + Amount*Payments! Total = Total + Amount*PaymentsPROGRAM & iii 4 Cont i nuat i onL i ne ! PROGRAM ContinuationLine

AlphabetsAlphabets

Fortran 90 alphabets include the following:Fortran 90
alphabets include the following:

Upper and lower cases letters

Di it Di g it s

Special characters

space' " ( ) * + - _ ! & $ ; < > 5

Constants:

1/6

Constants:

1/6

A Fortran 90 constant may be an integer, real,A

Fortran

90
constant may be an integer, real, logical, complex, and character string.

We will not discuss complex constants

We will not discuss complex constants

An integer constantis a string of digits with an

optional sign 12345
345
+789
+0 optional sign 12345
345
+789
+0 6

Constants:

2/6

Constants:

2/6 A real constant has two forms, decimal and A real constant has two forms, decimal and exponential:

In the

decimal form a real constant is a In the decimal form a real constant is a string of digits with exactly one decimal point A real constant may include anpoint A real constant may include an optional sign. Example: 2.45,.13,13., 012 12 0 12 12 7

Constants:

3/6

Constants:

3/6 A real constant has two forms, decimal and A real constant has two forms, decimal and exponential:

In the

exponential form a real constant In the exponential form a real constant starts with an integer/real, followed by a E/e, followed by an integer ( ie the exponent) followed by an integer i e the exponent)

Examples:

12E3
(12 10 3 12e3
12 10 3 12E3
(12 10 3 12e3
12 10 3

3.45E-8 (3.4510

-8 ), -3.45e-8 345
10 8 3 45
10 8

0E0(010

0 =0). 12.34-5is wrong! 8

Constants:

4/6

Constants:

4/6 A lo g ical constant is either .TRUE.or .FAL S E. g S

Note that the periods surrounding TRUEand

FALSE are required! FALSE are required! 9

Constants:

5/6

Constants:

5/6 A character string or character constant is a A character string orquotesdbs_dbs14.pdfusesText_20
[PDF] fortran syntax guide

[PDF] fortran syntax pdf

[PDF] fortran syntax sublime

[PDF] fortran syntax sublime text 3

[PDF] fortran tutorial download

[PDF] fortran tutorial example

[PDF] fortran tutorial linux

[PDF] fortran tutorial online

[PDF] fortran tutorial pdf free download

[PDF] fortran tutorial stanford

[PDF] fortran tutorial video

[PDF] fortran tutorial youtube

[PDF] fortran tutorialspoint pdf

[PDF] fortran vs c for scientific computing

[PDF] fortunately definition