A program to convert temperature in celsius to fahrenheit (Qbasic)

PROGRAM TO CONVERT TEMPERATURE IN CELSIUS TO FAHRENHEIT (Qbasic)
CLS
INPUT “ENTER TEMPERATURE IN CELSIUS”; C
F = C * (9 / 5) + 32
PRINT “TEMPERATURE IN FAHRENHEIT=”; F
END

  • USING SUB PROCEDURE
DECLARE SUB CONVERT (C)
CLS
INPUT “ENTER TEMPERATURE IN CELSIUS”; C
CALL CONVERT (C)
END

SUB CONVERT (C)
F = C * (9 / 5) + 32
PRINT “TEMPERATURE IN FAHRENHEIT=”; F
END SUB

  • USING FUNCTION PROCEDURE
DECLARE FUNCTION CONVERT (C)
CLS
INPUT “ENTER TEMPERATURE IN CELSIUS”; C
PRINT “TEMPERATURE IN FAHRENHEIT=”; CONVERT (C)
END

FUNCTION CONVERT (C)
F = C * (9 / 5) + 32
CONVERT = F
END FUNCTION

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.