! There are eight pints in a gallon and 1.76 pints a liter. The volume of the tank is given as 2
! gallons and 4 pints. Write a program that reads this volume in gallons and pints and converts it to
! Litres

PROGRAM VOLUME
IMPLICIT NONE
REAL,PARAMETER :: GALLON_PINTS = 8
REAL,PARAMETER :: LITRE_PINTS = 1.76
REAL :: INPUT_VOLUME_GALLONS, INPUT_PINTS_GALLONS
REAL:: EQUIVALENT_GALLONS_IN_PINTS, EQUIVALENT_PINTS_IN_LITRES,TOTAL_IN_PINTS

PRINT *,'INPUT THE NO OF GALLONS WORTH OF VOLUME'
READ *,INPUT_VOLUME_GALLONS
PRINT *,'INPUT THE NO OF PINTS WORTH OF VOLUME'
READ *,INPUT_PINTS_GALLONS

EQUIVALENT_GALLONS_IN_PINTS = INPUT_VOLUME_GALLONS * GALLON_PINTS
TOTAL_IN_PINTS = EQUIVALENT_GALLONS_IN_PINTS + INPUT_PINTS_GALLONS
EQUIVALENT_PINTS_IN_LITRES = TOTAL_IN_PINTS / LITRE_PINTS

PRINT 10, 'THE EQUIVALENT OF',INPUT_VOLUME_GALLONS,'GALLONS AND',INPUT_PINTS_GALLONS,'PINTS = ',EQUIVALENT_PINTS_IN_LITRES,'LITRES'
10 FORMAT (A,1X,F0.1,1X,A,1X,F0.4,1X,A,1X,F0.4,1X,A)

END PROGRAM VOLUME

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: