! to reverse a number. eg.  revnum(345) = 543
!   written on aug 11, 2000.  siva@cse.iitb.ernet.in
Program revnum

Integer :: num, ans

Write (*,*) "Type number (n) you want to reverse ->"
Read (*,*) num
Write (*,*) "Read in ", num

ans = 0

DO
 if (num == 0) EXIT
 ans = 10 * ans + mod(num, 10)
 num = num / 10
End Do

Write (*,*) "Reversed number is: ", ans
End Program revnum
