I have to create a program that reverses phrases.
For example: when I write hello guys, I want syug olleh
This is what I have for the moment but I don’t know how to reverse the characters in the board phraseT:
program reversing
implicit none
character(len=20),dimension(1:20)::phraseT
character(len=20)::phrase,reverse
integer::i,x
write(*,*)"write a phrase :"
read(*,'(a)')phrase
x=len(trim(phrase))
nomT(1:20)=" "
do i=1,x
nomT(i:i)=trim(phrase(i:i))
end do
write(*,*)nomT
end program reversing
One simple way to do it …
Others will come up with more intelligent ones (and shorter) for sure.