Skip to content

Commit

Permalink
Correct erroneous strlen computation in cancer.alan (#42)
Browse files Browse the repository at this point in the history
Fixes #41
  • Loading branch information
kostis authored Dec 4, 2024
1 parent 3d43526 commit 499c326
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions alan/programs/cancer.alan
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ cancer() : proc
{
writeString("Give a string with maximum length 30: ");
readString(30, source);
n = 0;
while (source[n]!='\0')
n = n+1;
n = n-1;
writeString(source);
n = strlen(source);
if (is_it(n, source) == 1)
writeString("\nIs not palindrome...");
writeString(" ... is not palindrome\n");
else
writeString("\nIs palindrome...");
writeString(" ... is palindrome\n");
}

0 comments on commit 499c326

Please sign in to comment.