SlideShare a Scribd company logo
1 of 17
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 javaVINOTH R
 
Fork and join framework
Fork and join frameworkFork and join framework
Fork and join frameworkMinh 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 IRoan Brasil Monteiro
 
Basics java programing
Basics java programingBasics java programing
Basics java programingDarshan Gohel
 
Refactoring Edit History of Source Code
Refactoring Edit History of Source CodeRefactoring Edit History of Source Code
Refactoring Edit History of Source CodeShinpei 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-phpapp01Engr.Tazeen Ahmed
 
Object Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;sObject Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;svivek p s
 
Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04Cp0675 03 may-2012-rm04
Cp0675 03 may-2012-rm04Parth Mudgal
 
Thread priorities35
Thread priorities35Thread priorities35
Thread priorities35myrajendra
 
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 RefactoringShinpei Hayashi
 
Loop in C Properties & Applications
Loop in C Properties & ApplicationsLoop in C Properties & Applications
Loop in C Properties & ApplicationsEmroz 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 JavaCharthaGaglani
 

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.pdfKirubelWondwoson1
 
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 notesmuhammadFaheem656405
 
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 KRKrishna 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
 
FlexUnit 4 for contributors
FlexUnit 4 for contributorsFlexUnit 4 for contributors
FlexUnit 4 for contributorsmichael.labriola
 
control statements
control statementscontrol statements
control statementsAzeem 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.docxsodhi3
 
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 statementsRai 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 statementsRai University
 
Overview of c language
Overview of c languageOverview of c language
Overview of c languageshalini392
 
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.pptManojKhadilkar1
 

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)
 
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
 
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)
 

Recently uploaded

Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 

Recently uploaded (20)

Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

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