Professional Documents
Culture Documents
M.SC 1 Year Computational Techniques
M.SC 1 Year Computational Techniques
Sc 1st year
Computational Techniques
Lecture 1.6
Loops control construct:
While loop
Loop runs infinite times until some condition
is not satisfied
Fortran Code:
Examples:
Following code will be executed 10 times
Following code will not be executed as
Following code will be executed four times
It is possible to branch out of do loop while
loop is executing
Cycle statement:
Example:
Result:
Exit statement:
Example:
Result:
Nested Do Loop:
Example:
Results:
Note that while using the nested Do loop we should name
the Do loops. Otherwise if by mistake, some End Do is
deleted then it becomes difficult to know that whose
End Do is missing.