program assign1_3
implicit none
integer :: i,j
real :: x
print*,'choose loop=1 or case=2'
read*,j
print*,'type i and x'
if(j == 1) then
   do
      read*,i,x
      if(i == 1) then
         print*,'natural logarithm of x =',log(x)
         print*,'base-10 logarithm of x =',log10(x)
      elseif(i == 2) then
         print*,'sine of x (radian) =',sin(x)
      elseif(i == 3) then
         print*,'square of x =',x*x
      else
         exit
      endif
   enddo
elseif(j == 2) then
   do
      read*,i,x
      select case(i)
      case(1)
         print*,'natural logarithm of x =',log(x)
         print*,'base-10 logarithm of x =',log10(x)
      case(2)
         print*,'sine of x (radian) =',sin(x)
      case(3)
         print*,'square of x =',x*x
      case default
         exit
      end select
   enddo
else
   stop 'Wrong choice!'
endif
end program assign1_3