Kenneth_Smith

Joined: 18 May 2012 Posts: 581 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Fri Mar 17, 2023 11:21 pm Post subject: |
|
|
You should be able to work it all out from this short program.
Code: |
program t
implicit none
integer i, j
i = 1
j = 0
! Six relational operators in Fortran
! Prints T for true, F for false
print*, (i == j) ! Test i equal to j
print*, (i /= j) ! Test i not equal to j
print*, (i > j) ! Test i greater than j
print*, (i < j) ! Test i less than j
print*, (i >= j) ! Test i greater than or equal to j
print*, (i <= j) ! Test i less than or equal to j
print*
! Equivalent older style (but still valid)
print*, (i .eq. j) ! Test i equal to j
print*, (i .ne. j) ! Test i not equal to j
print*, (i .gt. j) ! Test i greater and j
print*, (i .lt. j) ! Test i less than j
print*, (i .ge. j) ! Test i greater than or equal to j
print*, (i .le. j) ! Test i less than or equal to j
end program t |
|
|