C Program to find the reverse of a given number
write(*,*)'Enter an integer:'
read(*,*)n
m=n
rev=0
if (n.eq.0)then
write(*,*)'The reverse number is:',n
else
dowhile (n.ne.0)
r=mod(n,10)
rev=rev*10+r
n=n/10
end do
write(*,*)'The reverse of the given number is',rev
end if
end
write(*,*)'Enter an integer:'
read(*,*)n
m=n
rev=0
if (n.eq.0)then
write(*,*)'The reverse number is:',n
else
dowhile (n.ne.0)
r=mod(n,10)
rev=rev*10+r
n=n/10
end do
write(*,*)'The reverse of the given number is',rev
end if
end
Comments
Post a Comment