tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
15
Task/Palindrome-detection/Modula-3/palindrome-detection.mod3
Normal file
15
Task/Palindrome-detection/Modula-3/palindrome-detection.mod3
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
MODULE Palindrome;
|
||||
|
||||
IMPORT Text;
|
||||
|
||||
PROCEDURE isPalindrome(string: TEXT): BOOLEAN =
|
||||
VAR len := Text.Length(string);
|
||||
BEGIN
|
||||
FOR i := 0 TO len DIV 2 - 1 DO
|
||||
IF Text.GetChar(string, i) # Text.GetChar(string, (len - i - 1)) THEN
|
||||
RETURN FALSE;
|
||||
END;
|
||||
END;
|
||||
RETURN TRUE;
|
||||
END isPalindrome;
|
||||
END Palindrome.
|
||||
Loading…
Add table
Add a link
Reference in a new issue