Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
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
if (k==2) then
exit jloop
end if
end do kloop
end do jloop
end do iloop
end program nestedLoop
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
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
program factorial
implicit none
! define variables
integer :: nfact = 1
integer :: n
! compute factorials
do n = 1, 10
nfact = nfact * n
! print values
print*, n, " ", nfact
end do
end program factorial
program nestedSelectCase
! local variable definition
integer :: a = 100
integer :: b = 200
select case(a)
case (100)
print*, "This is part of outer switch", a
select case(b)
case (200)
print*, "This is part of inner switch", a
end select
end select
print*, "Exact value of a is : ", a
print*, "Exact value of b is : ", b
end program nestedSelectCase