Skip to content

Commit

Permalink
Solve p4 in fortran (3)
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Oct 2, 2024
1 parent 4ea61d0 commit 0285a10
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fortran/src/p0004.f90
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Problem0004
implicit none
contains
integer function p0004() result(answer)
integer :: i, j, k, prod, length
integer :: i, j, k, n, prod, length
logical :: is_palindrome
character(len=8) :: string

Expand All @@ -21,7 +21,8 @@ integer function p0004() result(answer)
length = len(string)

do k = 1, length
if (string(k) /= string(length - k + 1)) then
n = length - k + 1
if (string(k:k) /= string(n:n)) then
is_palindrome = .false.
exit
end if
Expand Down

0 comments on commit 0285a10

Please sign in to comment.