Preview Fortran Tutorial (PDF Version)

Preview Fortran Tutorial (PDF Version)

Fortran i Fortran About the Tutorial Fortran was originally developed by a team at IBM in 1957 for scientific calculations. Later developments made it into a high level programming language. In this tutorial, we will learn the basic concepts of Fortran and its programming code. Audience This tutorial is designed for the readers who wish to learn the basics of Fortran. Prerequisites This tutorial is designed for beginners. A general awareness of computer programming languages is the only prerequisite to make the most of this tutorial. Copyright & Disclaimer Copyright 2017 by Tutorials Point (I) Pvt. Ltd. All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish any contents or a part of contents of this e-book in any manner without written consent of the publisher. We strive to update the contents of our website and tutorials as timely and as precisely as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of our website or its contents including this tutorial. If you discover any errors on our website or in this tutorial, please notify us at [email protected] i Fortran Table of Contents About the Tutorial ····································································································································i Audience ··················································································································································i Prerequisites ············································································································································i Copyright & Disclaimer ·····························································································································i Table of Contents ···································································································································· ii 1. FORTRAN ─ OVERVIEW ········································································································ 1 Facts about Fortran ·································································································································1 2. FORTRAN ─ ENVIRONMENT SETUP ······················································································ 2 Setting up Fortran in Windows ················································································································2 How to Use G95 ······································································································································3 3. FORTRAN ─ BASIC SYNTAX ··································································································· 4 A Simple Program in Fortran ···················································································································4 Basics ······················································································································································5 Identifier ·················································································································································5 Keywords ················································································································································6 4. FORTRAN ─ DATA TYPES ······································································································ 8 Integer Type ············································································································································8 Real Type ················································································································································9 Complex Type········································································································································ 10 Logical Type ·········································································································································· 11 Character Type ······································································································································ 11 Implicit Typing ······································································································································· 11 ii Fortran 5. FORTRAN ─ VARIABLES ······································································································ 12 Variable Declaration······························································································································ 12 6. FORTRAN ─ CONSTANTS ···································································································· 15 Named Constants and Literals ··············································································································· 15 7. FORTRAN ─ OPERATORS ···································································································· 17 Arithmetic Operators ···························································································································· 17 Relational Operators ····························································································································· 19 Logical Operators ·································································································································· 21 Operators Precedence in Fortran ·········································································································· 23 8. FORTRAN ─ DECISIONS ······································································································ 26 If…then Construct ································································································································· 27 If… then… else Construct ······················································································································· 29 if...else if...else Statement ····················································································································· 31 Nested If Construct ······························································································································· 33 Select Case Construct ···························································································································· 34 Nested Select Case Construct ················································································································ 37 9. FORTRAN ─ LOOPS············································································································· 39 do Loop ················································································································································· 40 do-while Loop ······································································································································· 43 Nested Loops ········································································································································ 45 Loop Control Statements······················································································································· 46 Exit Statement ······································································································································ 47 Cycle Statement ···································································································································· 48 Stop Statement ····································································································································· 50 iii Fortran 10. FORTRAN ─ NUMBERS ······································································································· 51 Integer Type ·········································································································································· 51 Real Type ·············································································································································· 52 Complex Type········································································································································ 53 The Range, Precision, and Size of Numbers ··························································································· 55 The Kind Specifier ································································································································· 57 11. FORTRAN ─ CHARACTERS ·································································································· 59 Character Declaration ··························································································································· 59 Concatenation of Characters ················································································································· 60 Some Character Functions ····················································································································· 61 Checking

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    30 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us