A Program to convert temperature in Fahrenheit to Centigrade

  • A Program to convert temperature in Fahrenheit to Centigrade (Qbasic)
CLS
INPUT "ENTER TEMPERATURE IN FAHRENHEIT"; F
C = (F - 32) * (5 / 9)
PRINT "TEMPERATURE IN CELSIUS="; C
END

  • USING SUB PROCEDURE
DECLARE SUB CONVERT (F)
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
DECLARE FUNCTION CONVERT (F)
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

Share :

Facebook Twitter Google+
Back To Top

facebook main

counter

Powered by Blogger.