QBasic Programming

WAP to convert decimal number to binary number

CLS
INPUT "ENTER DECIMAL NUMBER"; D
WHILE D < > 0
R = D MOD 2
S$ = STR$(R) + S$
D = D \ 2
WEND
PRINT "BINARY EQUIVALENT VALUE="; S$
END
USING SUB PROCEDURE
DECLARE SUB CONV(D)
CLS
INPUT "ENTER DECIMAL NUMBER"; D
CALL CONV(D)
END
SUB CONV(D)
WHILE D  < > 0
R = D MOD 2
S$ = STR$(R) + S$
D = D \ 2
WEND
PRINT "BINARY EQUIVALENT VALUE="; S$
END
USING FUNCTION PROCEDURE
DECLARE SUB CONV$(D)
CLS
INPUT "ENTER DECIMAL NUMBER"; D
PRINT "BINARY EQUIVALENT VALUE=";  CONV$(D)
END
SUB CONV$(D)
WHILE D  < > 0
R = D MOD 2
S$ = STR$(R) + S$
D = D \ 2
WEND
CONV$ = S$
END FUNCTION

WAP to enter any three strings and print the longest one (Prev Lesson)
(Next Lesson) WAP to convert binary number to decimal number
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!