- A Program to convert temperature in Fahrenheit to Centigrade (Qbasic)
INPUT "ENTER TEMPERATURE IN FAHRENHEIT"; F
C = (F - 32) * (5 / 9)
PRINT "TEMPERATURE IN CELSIUS="; C
END
- USING SUB PROCEDURE
CLS
INPUT "ENTER TEMPERATURE IN FAHRENHEIT"; F
CALL CONVERT(F)
END
SUB CONVERT (F)
C = (F - 32) * (5 / 9)
PRINT "TEMPERATURE IN CELSIUS="; C
END SUB
- USING FUNCTION PROCEDURE
CLS
INPUT "ENTER TEMPERATURE IN FARENHEIT"; F
PRINT "TEMPERATURE IN CELCIUS="; CONVERT(F)
END
FUNCTION CONVERT (F)
C = (F - 32) * (5 / 9)
CONVERT = C
END FUNCTION