QBASIC : CONVERT DECIMAL INTO HEXADECIMAL

QBASIC : CONVERT DECIMAL INTO HEXADECIMAL



CLS
 INPUT ENTER DECIMAL NUMBER; D
 WHILE D < > 0
 R = D MOD 16
 IF R < 10 THEN
 S$ = STR$(R) + S$
 ELSE
 S$ = CHR$(R + 55) + S$
 END IF
 D = D  16
 WEND
 PRINT "HEXADECIMAL EQUIVALENT VALUE="; S$
 END

USING SUB


DECLARE SUB HEX(D)
 CLS
 INPUT ENTER DECIMAL NUMBER; D
 CALL HEX(D)
 END
 
 SUB HEX(D)
 WHILE D < > 0
 R = D MOD 16
 IF R < 10 THEN
 S$ = STR$(R) + S$
 ELSE
 S$ = CHR$(R + 55) + S$
 END IF
 D = D  16
 WEND
 PRINT "HEXADECIMAL EQUIVALENT VALUE="; S$
 END SUB

Post a Comment

0 Comments