Write a Fortran program that reads in the above input, and prints the input values and the results of .OR., .AND., .NEQV. and .EQV. in the following form:1 1 2 2 ....5....0....5....0....5 4 T .TR .TRUE. Franco February Truman .FALSE. fake
We use |, &, ^ and = to indicate .OR., .AND., .NEQV. and .EQV., respectively. Note that the first position is always for printer control.1 1 2 2 3 3 4 4 ....5....0....5....0....5....0....5....0....5 Truth Table ----------- P Q P | Q P & Q P ^ Q P = Q ----- ----- ----- ----- ----- ----- T T T T F T T F T F T F F T T F T F F F F F F T
Click here to download this program.PROGRAM Logical_Input IMPLICIT NONE LOGICAL :: P, Q INTEGER :: i, Number WRITE(*,"(A, A)") " ", " Truth Table" WRITE(*,"(A, A)") " ", " -----------" WRITE(*,*) WRITE(*,"(A,A)") " ", " P Q P | Q P & Q P ^ Q P = Q" WRITE(*,"(A,6A)") " ", (" -----", i = 1, 6) READ(*,"(I5)") Number DO i = 1, Number READ(*,"(2L10)") P, Q WRITE(*,"(A, 6L7)") " ", P, Q, & P .OR. Q, P .AND. Q, P .NEQV. Q, P .EQV. Q END DO END PROGRAM Logical_Input
1 1 2 2 3 3 4 4 ....5....0....5....0....5....0....5....0....5 Truth Table ----------- P Q P | Q P & Q P ^ Q P = Q ----- ----- ----- ----- ----- ----- T T T T F T T F T F T F F T T F T F F F F F F T