A simple program that I wrote before in Pascal to check if the word given by the user is a Palindrome or not a Palindrome. The code is very simple and easy to understand.
If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
Program Palindrome;
Uses Crt;
Label Finish;
VAR
StrIn, dForward, Reversed:String;
n:Integer;
ch:Char;
Palin:Boolean;
Begin
Clrscr;
Writeln; Writeln; Writeln;
Write(' PALINDROME PROGRAM IN PASCAL ');
Writeln(' Just Press Enter to quit the Program');
Repeat
Writeln;
Write('Enter a Word :==> ');
Readln(StrIn);
If StrIn = '' Then Goto Finis;
dForward := ''; Reversed := '';
For n := 1 to Length(StrIn) Do
Begin
ch := UpCase(StrIn[n]);
If ch in ['A'..'Z'] Then
Begin
dForward := dForward + ch;
Reversed := ch + Reversed
End;
End;
Palin := dForward = Reversed;
If Palin then Writeln('"',StrIn, '" is a palindrome.')
Else Writeln('"',StrIn, '" is not a palindrome.');
Finish:
Until StrIn = '';
END.