SlideShare a Scribd company logo
3/1/20181Presentation of Loops in Fortran
Group Members
Ahmad Subhan (06)
Safdar Tanver (12)
Izaz Ullah (31)
3/1/2018
2
Presentation of Loops in Fortran
LOOPS IN
FORTRAN
Presentation Topic
3/1/2018
3
Presentation of Loops in Fortran
Loop
3/1/2018Presentation of Loops in Fortran
4
What…..,
Why……,
When….,
Where…,
We use Loops in Fortran………………………………?
Loop
Type
Description
Do Loops This construct enables a statement, or a series of
statements, to be carried out iteratively, while a
given condition is true.
Do While
Loops
Repeats a statement or group of statements while a
given condition is true. It tests the condition before
executing the loop body.
Nested
Loops
You can use one or more loop construct inside any
other loop construct.
3/1/20185Presentation of Loops in Fortran
Do Loop
Syntax:
The general form of the do loop is:
Where,
the loop variable (var) should be an integer,
(start) is initial value,
(stop) is the final value,
(step) is the increment, if this is omitted, then the variable
(var) is increased by unity.
do var = start, stop [,step]
! statement(s)
…..…
end do
3/1/2018
6
Presentation of Loops in Fortran
Flow Chart of Do Loop
Start
Initialization
Condition
Code Block
Increment
End
TRUE
FALSE
3/1/2018
7
Presentation of Loops in Fortran
Code Snap Shot
program factorial
implicit none
integer :: n,nfact
! compute factorials
do n = 1, 10
nfact = nfact * n
! printing the value of n and
its factorial
print*, n , " factorial is= ",
nfact
end do
end program factorial
Example No 1
3/1/2018
8
Presentation of Loops in Fortran
Code Snap Shot
program printNum
implicit none
! define variables
integer :: n
do n = 11, 20
! printing the value of n
print*, n
end do
end program printNum
Example No 2
3/1/2018
9
Presentation of Loops in Fortran
Do-While Loop
It repeats a statement or a group of statements while
a given condition is true. It tests the condition before
executing the loop body.
Syntax:
do while (logical expr)
statements
end do
3/1/2018
10
Presentation of Loops in Fortran
Flow Chart of Do-While
3/1/2018
11
Presentation of Loops in Fortran
Code Snap Shot
program factorial
implicit none
! define variables
integer :: nfact = 1
integer :: n = 1
! compute factorials
do while (n <= 10)
nfact = nfact * n
n = n + 1
print*, n, " ", nfact
end do
end program factorial
Example No 3
3/1/2018
12
Presentation of Loops in Fortran
Nested
Loops
 You can use
one or more
loop construct
inside any
another loop
construct. You
can also put
labels on loops.
Syntax:
I loop: do i = 1, 3
print*, "i: ", i
J loop: do j = 1, 3
Print*, "j: ", j
K loop: do k = 1, 3
print*, "k: ", k
end do k loop
end do j loop
end do I loop
3/1/2018
13
Presentation of Loops in Fortran
Code
Snap Shot
program nestedLoop
implicit none
integer:: i, j, k
iloop: do i = 1, 3
jloop: do j = 1, 3
kloop: do k = 1, 3
print*, "(i, j, k): ", i, j, k
end do kloop
end do jloop
end do iloop
end program
nestedLoop
Example No 4
3/1/2018
14
Presentation of Loops in Fortran
References
 https://www.google.com.pk/search?q=loops&rlz=1C1EJFA_enAE698P
K699&oq=loops&aqs=chrome..69i57.2174j0j7&sourceid=chrome&ie=
UTF-8
 https://www.google.com.pk/search?q=do+loops&rlz=1C1EJFA_enAE6
98PK699&oq=do+loops&aqs=chrome..69i57.13846j0j9&sourceid=chr
ome&ie=UTF-8
 https://www.google.com.pk/search?q=nested+loop&rlz=1C1EJFA_en
AE698PK699&oq=nested+loop&aqs=chrome..69i57.6516j0j9&sourcei
d=chrome&ie=UTF-8
 https://www.google.com.pk/search?q=flowchart+fortran+pdf&rlz=1C1
EJFA_enAE698PK699&oq=flow&aqs=chrome.1.69i57j69i59l2.6443j0j
9&sourceid=chrome&ie=UTF-8
 https://www.google.com.pk/search?q=do+while+loops&rlz=1C1EJFA_
enAE698PK699&oq=do+while+loops&aqs=chrome..69i57.12782j0j9&
sourceid=chrome&ie=UTF-8
3/1/2018
15
Presentation of Loops in Fortran
3/1/201816Presentation of Loops in Fortran
3/1/201817Presentation of Loops in Fortran

More Related Content

What's hot

Control structures in java
Control structures in javaControl structures in java
Control structures in java
VINOTH R
 
Fork and join framework
Fork and join frameworkFork and join framework
Fork and join framework
Minh Tran
 
Java moderno java para Jedis episodio I
Java moderno  java para  Jedis  episodio IJava moderno  java para  Jedis  episodio I
Java moderno java para Jedis episodio I
Roan Brasil Monteiro
 
Basics java programing
Basics java programingBasics java programing
Basics java programing
Darshan Gohel
 
Refactoring Edit History of Source Code
Refactoring Edit History of Source CodeRefactoring Edit History of Source Code
Refactoring Edit History of Source Code
Shinpei Hayashi
 
Std 12 Computer Chapter 7 Java Basics (Part 2)
Std 12 Computer Chapter 7 Java Basics (Part 2)Std 12 Computer Chapter 7 Java Basics (Part 2)
Std 12 Computer Chapter 7 Java Basics (Part 2)
Nuzhat Memon
 
Polymorphism 140527082302-phpapp01
Polymorphism 140527082302-phpapp01Polymorphism 140527082302-phpapp01
Polymorphism 140527082302-phpapp01
Engr.Tazeen Ahmed
 
Object Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;sObject Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;s
vivek p s
 
Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04
Parth Mudgal
 
Cs 74
Cs 74Cs 74
Oracle: Cursors
Oracle: CursorsOracle: Cursors
Oracle: Cursors
DataminingTools Inc
 
Thread priorities35
Thread priorities35Thread priorities35
Thread priorities35
myrajendra
 
Historef: A Tool for Edit History Refactoring
Historef: A Tool  for Edit History RefactoringHistoref: A Tool  for Edit History Refactoring
Historef: A Tool for Edit History Refactoring
Shinpei Hayashi
 
Matlab isim link
Matlab isim linkMatlab isim link
Matlab isim link
Mohamed Abdelsalam
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & Applications
Emroz Sardar
 
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
FabMinds
 
Method Overloading In Java
Method Overloading In JavaMethod Overloading In Java
Method Overloading In Java
CharthaGaglani
 

What's hot (17)

Control structures in java
Control structures in javaControl structures in java
Control structures in java
 
Fork and join framework
Fork and join frameworkFork and join framework
Fork and join framework
 
Java moderno java para Jedis episodio I
Java moderno  java para  Jedis  episodio IJava moderno  java para  Jedis  episodio I
Java moderno java para Jedis episodio I
 
Basics java programing
Basics java programingBasics java programing
Basics java programing
 
Refactoring Edit History of Source Code
Refactoring Edit History of Source CodeRefactoring Edit History of Source Code
Refactoring Edit History of Source Code
 
Std 12 Computer Chapter 7 Java Basics (Part 2)
Std 12 Computer Chapter 7 Java Basics (Part 2)Std 12 Computer Chapter 7 Java Basics (Part 2)
Std 12 Computer Chapter 7 Java Basics (Part 2)
 
Polymorphism 140527082302-phpapp01
Polymorphism 140527082302-phpapp01Polymorphism 140527082302-phpapp01
Polymorphism 140527082302-phpapp01
 
Object Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;sObject Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;s
 
Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04
 
Cs 74
Cs 74Cs 74
Cs 74
 
Oracle: Cursors
Oracle: CursorsOracle: Cursors
Oracle: Cursors
 
Thread priorities35
Thread priorities35Thread priorities35
Thread priorities35
 
Historef: A Tool for Edit History Refactoring
Historef: A Tool  for Edit History RefactoringHistoref: A Tool  for Edit History Refactoring
Historef: A Tool for Edit History Refactoring
 
Matlab isim link
Matlab isim linkMatlab isim link
Matlab isim link
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & Applications
 
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
 
Method Overloading In Java
Method Overloading In JavaMethod Overloading In Java
Method Overloading In Java
 

Similar to Presentation of loops

Chapter 3 - Flow of Control Part II.pdf
Chapter 3  - Flow of Control Part II.pdfChapter 3  - Flow of Control Part II.pdf
Chapter 3 - Flow of Control Part II.pdf
KirubelWondwoson1
 
Unit3 cspc
Unit3 cspcUnit3 cspc
Unit3 cspc
BBDITM LUCKNOW
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
Niket Chandrawanshi
 
Chapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdfChapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdf
AamirShahzad527024
 
2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes
muhammadFaheem656405
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Krishna Raj
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
Prasanna Kumar SM
 
Loops
LoopsLoops
FlexUnit 4 for contributors
FlexUnit 4 for contributorsFlexUnit 4 for contributors
FlexUnit 4 for contributors
michael.labriola
 
control statements
control statementscontrol statements
control statements
Azeem Sultan
 
Repetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docxRepetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docx
sodhi3
 
Loop-1.pptx
Loop-1.pptxLoop-1.pptx
Ch05
Ch05Ch05
Loops and iteration.docx
Loops and iteration.docxLoops and iteration.docx
Loops and iteration.docx
NkurikiyimanaGodefre
 
Rac introduction
Rac introductionRac introduction
Rac introduction
Riyaj Shamsudeen
 
M C6java6
M C6java6M C6java6
M C6java6
mbruggen
 
Mca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statementsMca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statements
Rai University
 
Btech i pic u-3 handling input output and control statements
Btech i pic u-3 handling input output and control statementsBtech i pic u-3 handling input output and control statements
Btech i pic u-3 handling input output and control statements
Rai University
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
shalini392
 
2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
ManojKhadilkar1
 

Similar to Presentation of loops (20)

Chapter 3 - Flow of Control Part II.pdf
Chapter 3  - Flow of Control Part II.pdfChapter 3  - Flow of Control Part II.pdf
Chapter 3 - Flow of Control Part II.pdf
 
Unit3 cspc
Unit3 cspcUnit3 cspc
Unit3 cspc
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Chapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdfChapter 12 Computer Science ( ICS 12).pdf
Chapter 12 Computer Science ( ICS 12).pdf
 
2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
 
Decision making and loop in C#
Decision making and loop in C#Decision making and loop in C#
Decision making and loop in C#
 
Loops
LoopsLoops
Loops
 
FlexUnit 4 for contributors
FlexUnit 4 for contributorsFlexUnit 4 for contributors
FlexUnit 4 for contributors
 
control statements
control statementscontrol statements
control statements
 
Repetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docxRepetition Control and IO ErrorsPlease note that the mate.docx
Repetition Control and IO ErrorsPlease note that the mate.docx
 
Loop-1.pptx
Loop-1.pptxLoop-1.pptx
Loop-1.pptx
 
Ch05
Ch05Ch05
Ch05
 
Loops and iteration.docx
Loops and iteration.docxLoops and iteration.docx
Loops and iteration.docx
 
Rac introduction
Rac introductionRac introduction
Rac introduction
 
M C6java6
M C6java6M C6java6
M C6java6
 
Mca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statementsMca i pic u-3 handling input output and control statements
Mca i pic u-3 handling input output and control statements
 
Btech i pic u-3 handling input output and control statements
Btech i pic u-3 handling input output and control statementsBtech i pic u-3 handling input output and control statements
Btech i pic u-3 handling input output and control statements
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 
2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
 

Recently uploaded

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
Ayan Halder
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Envertis Software Solutions
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 

Recently uploaded (20)

LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Requirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional SafetyRequirement Traceability in Xen Functional Safety
Requirement Traceability in Xen Functional Safety
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative AnalysisOdoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
Odoo ERP Vs. Traditional ERP Systems – A Comparative Analysis
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 

Presentation of loops

  • 2. Group Members Ahmad Subhan (06) Safdar Tanver (12) Izaz Ullah (31) 3/1/2018 2 Presentation of Loops in Fortran
  • 4. Loop 3/1/2018Presentation of Loops in Fortran 4 What….., Why……, When…., Where…, We use Loops in Fortran………………………………?
  • 5. Loop Type Description Do Loops This construct enables a statement, or a series of statements, to be carried out iteratively, while a given condition is true. Do While Loops Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. Nested Loops You can use one or more loop construct inside any other loop construct. 3/1/20185Presentation of Loops in Fortran
  • 6. Do Loop Syntax: The general form of the do loop is: Where, the loop variable (var) should be an integer, (start) is initial value, (stop) is the final value, (step) is the increment, if this is omitted, then the variable (var) is increased by unity. do var = start, stop [,step] ! statement(s) …..… end do 3/1/2018 6 Presentation of Loops in Fortran
  • 7. Flow Chart of Do Loop Start Initialization Condition Code Block Increment End TRUE FALSE 3/1/2018 7 Presentation of Loops in Fortran
  • 8. Code Snap Shot program factorial implicit none integer :: n,nfact ! compute factorials do n = 1, 10 nfact = nfact * n ! printing the value of n and its factorial print*, n , " factorial is= ", nfact end do end program factorial Example No 1 3/1/2018 8 Presentation of Loops in Fortran
  • 9. Code Snap Shot program printNum implicit none ! define variables integer :: n do n = 11, 20 ! printing the value of n print*, n end do end program printNum Example No 2 3/1/2018 9 Presentation of Loops in Fortran
  • 10. Do-While Loop It repeats a statement or a group of statements while a given condition is true. It tests the condition before executing the loop body. Syntax: do while (logical expr) statements end do 3/1/2018 10 Presentation of Loops in Fortran
  • 11. Flow Chart of Do-While 3/1/2018 11 Presentation of Loops in Fortran
  • 12. Code Snap Shot program factorial implicit none ! define variables integer :: nfact = 1 integer :: n = 1 ! compute factorials do while (n <= 10) nfact = nfact * n n = n + 1 print*, n, " ", nfact end do end program factorial Example No 3 3/1/2018 12 Presentation of Loops in Fortran
  • 13. Nested Loops  You can use one or more loop construct inside any another loop construct. You can also put labels on loops. Syntax: I loop: do i = 1, 3 print*, "i: ", i J loop: do j = 1, 3 Print*, "j: ", j K loop: do k = 1, 3 print*, "k: ", k end do k loop end do j loop end do I loop 3/1/2018 13 Presentation of Loops in Fortran
  • 14. Code Snap Shot program nestedLoop implicit none integer:: i, j, k iloop: do i = 1, 3 jloop: do j = 1, 3 kloop: do k = 1, 3 print*, "(i, j, k): ", i, j, k end do kloop end do jloop end do iloop end program nestedLoop Example No 4 3/1/2018 14 Presentation of Loops in Fortran
  • 15. References  https://www.google.com.pk/search?q=loops&rlz=1C1EJFA_enAE698P K699&oq=loops&aqs=chrome..69i57.2174j0j7&sourceid=chrome&ie= UTF-8  https://www.google.com.pk/search?q=do+loops&rlz=1C1EJFA_enAE6 98PK699&oq=do+loops&aqs=chrome..69i57.13846j0j9&sourceid=chr ome&ie=UTF-8  https://www.google.com.pk/search?q=nested+loop&rlz=1C1EJFA_en AE698PK699&oq=nested+loop&aqs=chrome..69i57.6516j0j9&sourcei d=chrome&ie=UTF-8  https://www.google.com.pk/search?q=flowchart+fortran+pdf&rlz=1C1 EJFA_enAE698PK699&oq=flow&aqs=chrome.1.69i57j69i59l2.6443j0j 9&sourceid=chrome&ie=UTF-8  https://www.google.com.pk/search?q=do+while+loops&rlz=1C1EJFA_ enAE698PK699&oq=do+while+loops&aqs=chrome..69i57.12782j0j9& sourceid=chrome&ie=UTF-8 3/1/2018 15 Presentation of Loops in Fortran