
3
Simple Examples: ......................................................................................................................................... 21
An Important Note: ...................................................................................................................................... 21
More Complicated Examples: ....................................................................................................................... 21
Fortran Built-In Functions .................................................................................................................................... 22
Introduction..................................................................................................................................................... 22
Mathematical functions: .................................................................................................................................. 22
Other functions:............................................................................................................................................... 23
Functions in an Expression: .......................................................................................................................... 23
An Example: ................................................................................................................................................. 23
Input Statement: ................................................................................................................................................. 25
The READ Statement ........................................................................................................................................ 25
Preparing Input Data: ....................................................................................................................................... 25
Output Statement:............................................................................................................................................... 28
The WRITE Statement ...................................................................................................................................... 28
Output Format: ............................................................................................................................................ 29
Example 1: Three Programming Traps .............................................................................................................. 29
Solution ....................................................................................................................................................... 29
Program Output ........................................................................................................................................... 30
Explanation .................................................................................................................................................. 30
Programming Example 2: Quadratic Equation Solver ........................................................................................ 31
Problem Statement ...................................................................................................................................... 31
Solution ....................................................................................................................................................... 31
Program Output ........................................................................................................................................... 32
Explanation .................................................................................................................................................. 32
Example 3: The Length of a Parabola Segment ................................................................................................. 32
Problem Statement ...................................................................................................................................... 32
Solution ....................................................................................................................................................... 33
Program Output ........................................................................................................................................... 33
Explanation .................................................................................................................................................. 34
Example 4: Projectile Motion ........................................................................................................................... 34
Problem Statement ...................................................................................................................................... 34
Solution ....................................................................................................................................................... 34
Program Output ........................................................................................................................................... 35
Explanation .................................................................................................................................................. 35
Character Operator and Substrings Processing..................................................................................................... 36
Concatenation Operator // .............................................................................................................................. 36