u_conversion.f90
I suggest you either typed this as it appears into the compiler, or as
an easier way, just copy and paste it!
Note: I do not claim
the program will 100% work, but I give it my best. If it doesn't, try tweaking
it yourself, or email me about it, and I'll modify and post the improved version
later. Good luck!
PROGRAM u_conversion
IMPLICIT NONE
INTEGER :: menu_input
PRINT*, "Welcome to ADCY Unit Conversion Program"
PRINT*
PRINT*, "In this program, units in centimetre( which is entered by the user ) will be"
PRINT*, "converted into the corresponding value in yards, feet and inches. Basically it"
PRINT*, "converts metric unit system into English system."
PRINT*
1 PRINT*, "Please, tell me your selection:"
PRINT*, "(1) I can convert centimetres into inches..."
PRINT*, "(2) I can also convert centimetres into feet..."
PRINT*, "(3) Or do you want me to convert centimetres into yards?"
PRINT*, "(4) But really, if none of the above, I suggest you quit."
READ*, menu_input
IF (menu_input==1) THEN
CALL inches
GOTO 1
ELSE IF (menu_input==2) THEN
CALL feet
GOTO 1
ELSE IF (menu_input==3) THEN
CALL yards
GOTO 1
ELSE IF (menu_input==4) THEN
GOTO 2
ELSE
PRINT*, "What kind of a selection is this?!"
PRINT*, "Please make a valid selection!"
PRINT*
GOTO 1
END IF
2 PRINT*, "Thank you for using ADCY Unit Conversion Program"
PRINT*, "Have a nice day:)"
END PROGRAM u_conversion
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SUBROUTINE inches
IMPLICIT NONE
REAL :: cm, inch
PRINT*
PRINT*, "Unit in centimetres?"
READ*, cm
inch = 0.3937 * cm
PRINT*
PRINT*, cm, "cm"
PRINT*, "corresponds to"
PRINT*, inch, " in.."
PRINT*
RETURN
END SUBROUTINE inches
!----------------------------------------------------------------------------------------------
SUBROUTINE feet
IMPLICIT NONE
REAL :: cm, inch, ft
PRINT*
PRINT*, "Unit in centimetres?"
READ*, cm
inch=0.3937*cm
ft=0.08333*inch
PRINT*
PRINT*, cm, "cm"
PRINT*, "corresponds to"
PRINT*, ft, "feet"
PRINT*
RETURN
END SUBROUTINE feet
!----------------------------------------------------------------------------------------------
SUBROUTINE yards
IMPLICIT NONE
REAL :: cm, inch, ft, yrd
PRINT*
PRINT*, "Unit in centimetres?"
READ*, cm
inch=0.3937*cm
ft=0.08333*inch
yrd=0.33333*ft
PRINT*
PRINT*, cm, "cm"
PRINT*, "corresponds to"
PRINT*, yrd, "yards"
PRINT*
RETURN
END SUBROUTINE yards