PROGRAM SUB_INT_COUNT
IMPLICIT NONE
INTEGER :: u, v, MyProd, MySum
CHARACTER :: Flag
DO
PRINT *, "Enter two positive integers u and v:"
READ *, u, v
CALL IntCount(u*v,MyProd)
PRINT *, "The number of digits in the product is: ", MyProd, "."
CALL IntCount(u+v,MySum)
PRINT *, "The number of digits in the sum is: ", MySum, "."
PRINT *, 'Continue? If not, press "n" or "N"; else press any other key.'
READ *, Flag
IF ((Flag=="n") .OR. (Flag=="N")) EXIT
END DO
CONTAINS
SUBROUTINE IntCount(n,IC)
INTEGER :: k
INTEGER, INTENT(IN) :: n
INTEGER, INTENT(OUT) :: IC
k=n
IC=0
DO
k=k/10
IC=IC+1
IF (k==0) EXIT
END DO
END SUBROUTINE IntCount
END PROGRAM SUB_INT_COUNT