SlideShare uma empresa Scribd logo
1 de 19
The FORTRAN Programming
        Language




                      Zaahir Salam
How to get FORTRAN 95 Compiler
• Write FTN silverfrost in google and download it for free
History
• One of the oldest programming languages, the FORTRAN was
  developed by a team of programmers at IBM led by John
  Backus, and was first published in 1957.
• The name FORTRAN is an acronym for FORmula TRANslation,
  because it was designed to allow easy translation of math
  formulas into code.
• Often referred to as a scientific language, FORTRAN was the
  first high-level language, using the first compiler ever
  developed.
• Prior to the development of FORTRAN computer
  programmers were required to program in machine/assembly
  code, which was an extremely difficult and time consuming
  task, difficult to debug the code.
Significant Language Features
• Simple to learn

• Machine Independent - allows for easy transportation of a program
  from one machine to another.

• More natural ways to express mathematical functions - FORTRAN
  permits even severely complex mathematical functions to be
  expressed similarly to regular algebraic notation.

• Problem orientated language

• Remains close to and exploits the available hardware

• Efficient execution - there is only an approximate 20% decrease in
  efficiency as compared to assembly/machine code.
Areas of Application

• Number crunching - due to the more natural (like it's true
  algebraic form) way of expressing complex mathematical
  functions and it's quick execution time, FORTRAN is easy and
  efficient at processing mathematical equations.

• Scientific, mathematical, statistical, and engineering type
  procedures -due to it's rapid number-crunching ability
  FORTRAN is a good choice for these type of applications.
Basic Elements of Fortran Program
The Fortran Character Set
The following are valid in a Fortran 90/95 program:

alpha-numeric:      a-z, A-Z, 0-9, and _ (the underscore);

arithmetic symbols: +, -, *, /, **

miscellaneous symbols: e.g.
   ,     comma
   .     decimal point
    <    less than
etc
Structure of a FORTRAN Statement

 A program consists of a series of statements
  designed to accomplish the goal.

 There are two basic types of statements:
  Executable statements describe the actions taken
  by the program (additions, subtractions,
  multiplications, divisions).
  Non-executable statements provide information
  necessary for proper operation of the program.
Rules on Fortran statements:
Each line may be up to 132 characters long.
A statement too long to fit in a single line may be
    continued on the next line by ending the
    current line with an & (ampersand). e. g.
output = input1 + input2 ! sum the inputs

Commenting your code is very important. To
    comment in FORTRAN, one uses the
    exclamation point (!)
All comments after the ! are ignored by the
    compiler
Structure of a Fortran Program

A FORTRAN program can be divided into three sections:

Declarations - This section consists of a group of non-executable
     statements at the start of the program.

Execution - This section consists of one or more statements
    describing the actions to be performed by the program.

Termination - This section consists of a statement (or
    statements) telling the computer to stop/end running the
    program.
The program reads two numbers as input,
   multiplies them, and prints out the result
PROGRAM my_first_program
! Purpose:
! To illustrate some of the basic features of a
    Fortran program.
!
! Declare the variables used in this program.
INTEGER :: i, j, k      ! All variables are integers
! Get two values to store in variables i and j
WRITE (*,*) 'Enter the numbers to multiply: '
READ (*,*) i, j
Continued…
! Multiply the numbers together
k=i*j
! Write out the result.
WRITE (*,*) 'Result = ', k
! Finish up.
STOP
END PROGRAM my_first_program
Discussion of Program Above

The first statement of this program begins with the word
     PROGRAM. This is a non-executable statement that
     specifies the name of the program to the FORTRAN
     compiler.

The name may be up to 31 characters long and be any
     combination of alphabetic characters, digits, and the
     underscore.

The first character must be a letter.

The PROGRAM statement must be the first line of the program.
The Declaration Section
This section begins with a comment stating that variable
     declarations are to follow.

The declaration begins with the data type (INTEGER) followed by
     two colons and then the variable name.

A comment follows the variable name. Every variable must be
    commented as to its purpose in the program.

These statements are non-executable.
The Execution Section

The first statement in this section is the WRITE statement
    that tells the user to enter the input.

The second statement will read the input and assign the
    values to the corresponding variables.

The third statement multiplies the two variables and the
    product is assigned to a third variable.

The last executable statement prints the product to the
    screen.
The Termination Section

The STOP statement tells the computer to stop
   running the program.
The use of the STOP command is optional here.
The END PROGRAM statement informs the
   compiler that no more statements exist.
Compiling and Executing the FORTRAN Program



Before a program can be run (executed) it must be compiled into
    an executable program.

In this process the code may also be linked to various system
      libraries.
Variables and the IMPLICIT NONE


Checking a constant (e.g.7, 3.14156, 'John'), it is easy to
    determine which type it may be. However, for a variable,
    we must assign a type to that variable.

Assigning a type reserves the memory needed to store the data
    expected (e.g.4 bytes for: 7 , 3.14156 and
   2 bytes/letter for: 'John').
Live Demonstration
Thank You for Your Kind
       attention

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

PYTHON NOTES
PYTHON NOTESPYTHON NOTES
PYTHON NOTES
 
Lecture 1- History of C Programming
Lecture 1- History of C Programming Lecture 1- History of C Programming
Lecture 1- History of C Programming
 
C++ Overview PPT
C++ Overview PPTC++ Overview PPT
C++ Overview PPT
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
High level and Low level Language
High level and Low level Language High level and Low level Language
High level and Low level Language
 
Introduction to Programming Languages
Introduction to Programming LanguagesIntroduction to Programming Languages
Introduction to Programming Languages
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
C Programming: Control Structure
C Programming: Control StructureC Programming: Control Structure
C Programming: Control Structure
 
Unit 3. Input and Output
Unit 3. Input and OutputUnit 3. Input and Output
Unit 3. Input and Output
 
FUNCTIONS IN C PROGRAMMING.pdf
FUNCTIONS IN C PROGRAMMING.pdfFUNCTIONS IN C PROGRAMMING.pdf
FUNCTIONS IN C PROGRAMMING.pdf
 
generation of programming language
generation of programming languagegeneration of programming language
generation of programming language
 
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEWPYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
PYTHON CURRENT TREND APPLICATIONS- AN OVERVIEW
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
Introduction to Basic C programming 01
Introduction to Basic C programming 01Introduction to Basic C programming 01
Introduction to Basic C programming 01
 
Engineering mathematics 1
Engineering mathematics 1Engineering mathematics 1
Engineering mathematics 1
 
Computer Language
Computer LanguageComputer Language
Computer Language
 
Structure of a C program
Structure of a C programStructure of a C program
Structure of a C program
 
Generations of programming language
Generations of programming languageGenerations of programming language
Generations of programming language
 
types of loops and what is loop
types of loops and what is looptypes of loops and what is loop
types of loops and what is loop
 

Semelhante a Fortran 95

4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
hccit
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answers
vithyanila
 
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
venkatapranaykumarGa
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
smkengkilili2011
 

Semelhante a Fortran 95 (20)

1922071042 - Mohammad Saiful Islam - CSE425.5 (MSAH) - Presentation - Fortran...
1922071042 - Mohammad Saiful Islam - CSE425.5 (MSAH) - Presentation - Fortran...1922071042 - Mohammad Saiful Islam - CSE425.5 (MSAH) - Presentation - Fortran...
1922071042 - Mohammad Saiful Islam - CSE425.5 (MSAH) - Presentation - Fortran...
 
C programming
C programmingC programming
C programming
 
C programming course material
C programming course materialC programming course material
C programming course material
 
Chapter#01 cc
Chapter#01 ccChapter#01 cc
Chapter#01 cc
 
COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis: COMPILER DESIGN- Introduction & Lexical Analysis:
COMPILER DESIGN- Introduction & Lexical Analysis:
 
4 coding from algorithms
4 coding from algorithms4 coding from algorithms
4 coding from algorithms
 
Unit 3.1 Algorithm and Flowchart
Unit 3.1 Algorithm and FlowchartUnit 3.1 Algorithm and Flowchart
Unit 3.1 Algorithm and Flowchart
 
Compiler presentaion
Compiler presentaionCompiler presentaion
Compiler presentaion
 
265 ge8151 problem solving and python programming - 2 marks with answers
265   ge8151 problem solving and python programming - 2 marks with answers265   ge8151 problem solving and python programming - 2 marks with answers
265 ge8151 problem solving and python programming - 2 marks with answers
 
Intro to c programming with all basic concept with clear explanation and example
Intro to c programming with all basic concept with clear explanation and exampleIntro to c programming with all basic concept with clear explanation and example
Intro to c programming with all basic concept with clear explanation and example
 
Compiler Construction introduction
Compiler Construction introductionCompiler Construction introduction
Compiler Construction introduction
 
Computer and programing basics.pptx
Computer and programing basics.pptxComputer and programing basics.pptx
Computer and programing basics.pptx
 
6272 cnote
6272 cnote6272 cnote
6272 cnote
 
C progrmming
C progrmmingC progrmming
C progrmming
 
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
2-Design Issues, Patterns, Lexemes, Tokens-28-04-2023.docx
 
unit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdfunit1pdf__2021_12_14_12_37_34.pdf
unit1pdf__2021_12_14_12_37_34.pdf
 
Intro to c++
Intro to c++Intro to c++
Intro to c++
 
design intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdfdesign intoduction of_COMPILER_DESIGN.pdf
design intoduction of_COMPILER_DESIGN.pdf
 
Chapter 5( programming) answer
Chapter 5( programming) answerChapter 5( programming) answer
Chapter 5( programming) answer
 
Phases of Compiler.pptx
Phases of Compiler.pptxPhases of Compiler.pptx
Phases of Compiler.pptx
 

Mais de Zaahir Salam

Transposons(jumping genes)
Transposons(jumping genes)Transposons(jumping genes)
Transposons(jumping genes)
Zaahir Salam
 
Secondary ion mass spectrometry
Secondary ion mass spectrometrySecondary ion mass spectrometry
Secondary ion mass spectrometry
Zaahir Salam
 
Nanotechnology in Defence applications
Nanotechnology in Defence applicationsNanotechnology in Defence applications
Nanotechnology in Defence applications
Zaahir Salam
 

Mais de Zaahir Salam (20)

J&K RTI Act 2009
J&K RTI Act 2009 J&K RTI Act 2009
J&K RTI Act 2009
 
How to configure a ZTE Router with easy steps.
How to configure a ZTE Router with easy steps.How to configure a ZTE Router with easy steps.
How to configure a ZTE Router with easy steps.
 
Intorduction to cellular communication
Intorduction to cellular communicationIntorduction to cellular communication
Intorduction to cellular communication
 
Modern cellular communication
Modern cellular communicationModern cellular communication
Modern cellular communication
 
Wireless sensor networks
Wireless sensor networksWireless sensor networks
Wireless sensor networks
 
Magnetic field sensing
Magnetic field sensingMagnetic field sensing
Magnetic field sensing
 
Superhard nanocomposites
Superhard nanocompositesSuperhard nanocomposites
Superhard nanocomposites
 
Biological transport of nanoparticles
Biological transport of nanoparticlesBiological transport of nanoparticles
Biological transport of nanoparticles
 
Photonic crystals by self assembly
Photonic crystals by self assemblyPhotonic crystals by self assembly
Photonic crystals by self assembly
 
Piezoelectricity : Think Locally, Act Globally
Piezoelectricity : Think Locally, Act GloballyPiezoelectricity : Think Locally, Act Globally
Piezoelectricity : Think Locally, Act Globally
 
Graphene -Applications in Electronics
Graphene -Applications in ElectronicsGraphene -Applications in Electronics
Graphene -Applications in Electronics
 
Self assembly in photovoltaic devices
Self assembly in photovoltaic devicesSelf assembly in photovoltaic devices
Self assembly in photovoltaic devices
 
Ferroelectric and piezoelectric materials
Ferroelectric and piezoelectric materialsFerroelectric and piezoelectric materials
Ferroelectric and piezoelectric materials
 
Transposons(jumping genes)
Transposons(jumping genes)Transposons(jumping genes)
Transposons(jumping genes)
 
Secondary ion mass spectrometry
Secondary ion mass spectrometrySecondary ion mass spectrometry
Secondary ion mass spectrometry
 
Order disorder transformation( the kinetics behind)
Order disorder transformation( the kinetics behind)Order disorder transformation( the kinetics behind)
Order disorder transformation( the kinetics behind)
 
Xps (x ray photoelectron spectroscopy)
Xps (x ray photoelectron spectroscopy)Xps (x ray photoelectron spectroscopy)
Xps (x ray photoelectron spectroscopy)
 
Graphene a wonder material
Graphene a wonder materialGraphene a wonder material
Graphene a wonder material
 
D&euv lithography final
D&euv lithography finalD&euv lithography final
D&euv lithography final
 
Nanotechnology in Defence applications
Nanotechnology in Defence applicationsNanotechnology in Defence applications
Nanotechnology in Defence applications
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Fortran 95

  • 1. The FORTRAN Programming Language Zaahir Salam
  • 2. How to get FORTRAN 95 Compiler • Write FTN silverfrost in google and download it for free
  • 3. History • One of the oldest programming languages, the FORTRAN was developed by a team of programmers at IBM led by John Backus, and was first published in 1957. • The name FORTRAN is an acronym for FORmula TRANslation, because it was designed to allow easy translation of math formulas into code. • Often referred to as a scientific language, FORTRAN was the first high-level language, using the first compiler ever developed. • Prior to the development of FORTRAN computer programmers were required to program in machine/assembly code, which was an extremely difficult and time consuming task, difficult to debug the code.
  • 4. Significant Language Features • Simple to learn • Machine Independent - allows for easy transportation of a program from one machine to another. • More natural ways to express mathematical functions - FORTRAN permits even severely complex mathematical functions to be expressed similarly to regular algebraic notation. • Problem orientated language • Remains close to and exploits the available hardware • Efficient execution - there is only an approximate 20% decrease in efficiency as compared to assembly/machine code.
  • 5. Areas of Application • Number crunching - due to the more natural (like it's true algebraic form) way of expressing complex mathematical functions and it's quick execution time, FORTRAN is easy and efficient at processing mathematical equations. • Scientific, mathematical, statistical, and engineering type procedures -due to it's rapid number-crunching ability FORTRAN is a good choice for these type of applications.
  • 6. Basic Elements of Fortran Program The Fortran Character Set The following are valid in a Fortran 90/95 program: alpha-numeric: a-z, A-Z, 0-9, and _ (the underscore); arithmetic symbols: +, -, *, /, ** miscellaneous symbols: e.g. , comma . decimal point < less than etc
  • 7. Structure of a FORTRAN Statement  A program consists of a series of statements designed to accomplish the goal.  There are two basic types of statements: Executable statements describe the actions taken by the program (additions, subtractions, multiplications, divisions). Non-executable statements provide information necessary for proper operation of the program.
  • 8. Rules on Fortran statements: Each line may be up to 132 characters long. A statement too long to fit in a single line may be continued on the next line by ending the current line with an & (ampersand). e. g. output = input1 + input2 ! sum the inputs Commenting your code is very important. To comment in FORTRAN, one uses the exclamation point (!) All comments after the ! are ignored by the compiler
  • 9. Structure of a Fortran Program A FORTRAN program can be divided into three sections: Declarations - This section consists of a group of non-executable statements at the start of the program. Execution - This section consists of one or more statements describing the actions to be performed by the program. Termination - This section consists of a statement (or statements) telling the computer to stop/end running the program.
  • 10. The program reads two numbers as input, multiplies them, and prints out the result PROGRAM my_first_program ! Purpose: ! To illustrate some of the basic features of a Fortran program. ! ! Declare the variables used in this program. INTEGER :: i, j, k ! All variables are integers ! Get two values to store in variables i and j WRITE (*,*) 'Enter the numbers to multiply: ' READ (*,*) i, j
  • 11. Continued… ! Multiply the numbers together k=i*j ! Write out the result. WRITE (*,*) 'Result = ', k ! Finish up. STOP END PROGRAM my_first_program
  • 12. Discussion of Program Above The first statement of this program begins with the word PROGRAM. This is a non-executable statement that specifies the name of the program to the FORTRAN compiler. The name may be up to 31 characters long and be any combination of alphabetic characters, digits, and the underscore. The first character must be a letter. The PROGRAM statement must be the first line of the program.
  • 13. The Declaration Section This section begins with a comment stating that variable declarations are to follow. The declaration begins with the data type (INTEGER) followed by two colons and then the variable name. A comment follows the variable name. Every variable must be commented as to its purpose in the program. These statements are non-executable.
  • 14. The Execution Section The first statement in this section is the WRITE statement that tells the user to enter the input. The second statement will read the input and assign the values to the corresponding variables. The third statement multiplies the two variables and the product is assigned to a third variable. The last executable statement prints the product to the screen.
  • 15. The Termination Section The STOP statement tells the computer to stop running the program. The use of the STOP command is optional here. The END PROGRAM statement informs the compiler that no more statements exist.
  • 16. Compiling and Executing the FORTRAN Program Before a program can be run (executed) it must be compiled into an executable program. In this process the code may also be linked to various system libraries.
  • 17. Variables and the IMPLICIT NONE Checking a constant (e.g.7, 3.14156, 'John'), it is easy to determine which type it may be. However, for a variable, we must assign a type to that variable. Assigning a type reserves the memory needed to store the data expected (e.g.4 bytes for: 7 , 3.14156 and 2 bytes/letter for: 'John').
  • 19. Thank You for Your Kind attention