Qbasic Program to print sum of digits of the given number
Posted by Mahibabu
REM Program to print sum of the digits of a given number
CLS
INPUT "Enter any digit"; n
WHILE n <> 0
r = n MOD 10
s = s + r
n = n \ 10
WEND
PRINT "Sum of digits is "; s
END
Hi, I am Mahesh Bhandari from Kathmandu, Nepal.
Posted by Mahibabu
REM Program to print sum of the digits of a given number
CLS
INPUT "Enter any digit"; n
WHILE n <> 0
r = n MOD 10
s = s + r
n = n \ 10
WEND
PRINT "Sum of digits is "; s
END
Posted by Mahibabu
REM Qbasic Program to convert decimal number into binary number
CLS
INPUT "enter decimal number"; d
WHILE d <> 0
r = d MOD 2
r$ = STR$(r)
s$ = r$ + s$
d = d \ 2
WEND
PRINT "binary number is"; s$
END
Posted by Mahibabu
CLS
INPUT "Enter number of minutes"; m
hr = m \ 60
mi = m MOD 60
PRINT m; " minutes = "; hr; " hours and "; mi; " minutes."
END
Posted by Mahibabu
CLS
INPUT "Enter decimal number"; d
WHILE d <> 0
r = d MOD 16
IF r = 10 THEN
r$ = "A"
ELSEIF r = 11 THEN
r$ = "B"
ELSEIF r = 12 THEN
r$ = "C"
ELSEIF r = 13 THEN
r$ = "D"
ELSEIF r = 14 THEN
r$ = "E"
ELSEIF r = 15 THEN
r$ = "F"
ELSE
r$ = STR$(r)
END IF
h$ = r$ + h$
d = d \ 16
WEND
PRINT "Hexadecimal is"; h$
END
Posted by Mahibabu
REM Program to print all prime numbers from 1 to 100
CLS
FOR n = 2 TO 100
FOR k = 2 TO n / 2
flag = 0
r = n MOD k
IF r = 0 THEN
flag = 1
EXIT FOR
END IF
NEXT k
IF flag = 0 THEN PRINT n,
NEXT n
END
Posted by Mahibabu
Click on Start then run.
Type regedit and press Enter key.
Double click on HKEY_CURRENT_USER then on software.
Double click on Yahoo. Then on pager. Finally on Test.
After that on the blank space in middle, right click and click on New. Then, on DWORD VALUE.
Give the name as plural.
Right click on plural and set the binary value as 1.
Restart your computer.
Sign in with as many accounts you have and enjoy.
Posted by Mahibabu
REM Program to print the given sentence into titlecase
CLS
INPUT "Enter a sentence"; s$
b$ = UCASE$(MID$(s$, 1, 1))
w$ = w$ + b$
FOR i = 2 TO LEN(s$)
IF RIGHT$(w$, 1) = " " THEN
b$ = UCASE$(MID$(s$, i, 1))
ELSEb$ = LCASE$(MID$(s$, i, 1))
END IF
w$ = w$ + b$
NEXT i
PRINT w$
END