mailbox.f90
I suggest you either typed this as it appears into the compiler, or as
an easier way, just copy and paste it!
Note: I do not claim
the program will 100% work, but I give it my best. If it doesn't, try tweaking
it yourself, or email me about it, and I'll modify and post the improved version
later. Good luck!
PROGRAM mailbox
IMPLICIT NONE
!Array is mailboxes
LOGICAL, DIMENSION(1:150) :: mailboxes=.FALSE.
INTEGER :: i, j ,k !These will be counter variables
PRINT*, "Welcome to ADCY Mailbox Program"
PRINT*, "WARNING: This is a demonstater program. It has no practical application whatsoever."
PRINT*, "(At least not the one that I know of)"
!The part where I change the valu of all even numbered elements to TRUE
j=2
DO WHILE(j<=150)
mailboxes(j:150:j)=.true.
j=j+2
END DO
!The part where it took me SIX hours to crack (including one with my friend)!!!
!This part is basically the part where the previous element value is 'inverted'
!i.e:.FALSE. becomes .TRUE.
i=2
DO WHILE(i<=150) !Does the row by row jumping part(i.e:finish one line
j=i+1 !then move to the next)
k=i+1
DO WHILE (j<=150) !Does the column by column 'inverting'
IF (mailboxes(j)==.TRUE.) THEN
mailboxes(j)=.FALSE.
ELSE IF (mailboxes(j)==.FALSE.) THEN
mailboxes(j)=.TRUE.
END IF
j=j+k
END DO
!PRINT*, mailboxes
!The above line is the one I initially use
i=i+1
END DO
PRINT*, "I Believe this is the answer you want?"
PRINT*, mailboxes !The long answer
PRINT*
PRINT*, "Thank you for using ADCY Mailbox Program"
PRINT*, "Have a nice day:)"
END PROGRAM mailbox