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
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
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
CLS
INPUT “ENTER TEMPERATURE IN CELSIUS”; C
F = C * (9 / 5) + 32
PRINT “TEMPERATURE IN FAHRENHEIT=”; F
END
- USING SUB PROCEDURE
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
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