
Patrick B. answered 10/31/20
Math and computer tutor/teacher
'OLD FORTRAN 77
program hello
Print *, "Hello World!"
Implicit None
CHARACTER(Length=1) :: LeftChar
CHARACTER(Length=1) :: RightChar
CHARACTER(Length=25) :: InputStr
'Compares the characters at iLeft and iRight: if they DIFFER then it's not a palindrome!!!!
iLeft :: Integer
iRight :: Integer
iPalindromeFlag :: Integer
InputStr = "ABBA"
iLeft = 1
iRight = Len(inputStr)
iPalindromeFlag = 1
do while (iLeft <= iRight)
LeftChar = InputStr(iLeft:1)
RightChar = InputStr(iRight:1)
if (UPPER(LeftChar)/=Upper(RightChar)) then 'they are not the same, so not a palindrome
iPalindromeFlag = 0 'sets the flag to false and bails out
exit
end if
'moves the pointers
iLeft = iLeft + 1
iRight = iRight - 1
end do
print *,iPalindromeFlag
end program Hello