CLS
INPUT "Enter any number"; N
S = 0
WHILE N<> 0
R = N MOD 10
S = S*10+R
N = N\10
WEND
PRINT "Reverse of digits="; S
END
Wednesday, October 2, 2019
Qbasic to find product of digit
CLS
INPUT "Enter any number'; N
P = 1
WHILE N<> 0
R = N MOD 10
P = P*R
N = N\10
WEND
PRINT "Product of digits="; P
END
INPUT "Enter any number'; N
P = 1
WHILE N<> 0
R = N MOD 10
P = P*R
N = N\10
WEND
PRINT "Product of digits="; P
END
Qbasic to find sum of digit
CLS
INPUT "Enter any number"; N
S = 0
WHILE N<> 0
R = N MOD 10
S = S+R
N = N\10
WEND
PRINT "Sum of digits="; S
END
INPUT "Enter any number"; N
S = 0
WHILE N<> 0
R = N MOD 10
S = S+R
N = N\10
WEND
PRINT "Sum of digits="; S
END
Qbasic to print greatest among three numbers
CLS
INPUT "Enter any three number"; A, B, C
IF A>B AND A>C THEN
PRINT "The greatest number is"; A
ELSEIF B>A AND B>C THEN
PRINT "The greatest number is"; B
ELSE
PRINT "The greatest number is"; C
END IF
END
INPUT "Enter any three number"; A, B, C
IF A>B AND A>C THEN
PRINT "The greatest number is"; A
ELSEIF B>A AND B>C THEN
PRINT "The greatest number is"; B
ELSE
PRINT "The greatest number is"; C
END IF
END
Qbasic to find odd or even
CLS
INPUT "Enter any number"; N
IF N MOD 2 = 0 THEN
PRINT "The number is even"
ELSE
PRINT "The number is odd"
END IF
END
INPUT "Enter any number"; N
IF N MOD 2 = 0 THEN
PRINT "The number is even"
ELSE
PRINT "The number is odd"
END IF
END
Qbasic to display Positive,Negative or Zero
CLS
INPUT "Enter any number"; N
IF N>0 THEN
PRINT "The number is positive"
ELSEIF N<0 THEN
PRINT " The number is negative"
ELSE
PRINT "The number is zero"
END IF
END
INPUT "Enter any number"; N
IF N>0 THEN
PRINT "The number is positive"
ELSEIF N<0 THEN
PRINT " The number is negative"
ELSE
PRINT "The number is zero"
END IF
END
Qbasic to find volume of cylinder
CLS
INPUT "Enter the radius"; R
INPUT "Enter the height"; H
V = 22/7*R^2*H
PRINT "Volume of cylinder="; V
END
INPUT "Enter the radius"; R
INPUT "Enter the height"; H
V = 22/7*R^2*H
PRINT "Volume of cylinder="; V
END
Subscribe to:
Posts (Atom)
Digital Footprint
Computer technology is a technology that instead of building a physical machine for each application builds a logical or virtual machine. ...
-
Firstly when I heard that we are going tour to Dhading for 2 days I was so much excited to go there. The day when I got notice after reachin...
-
Computer technology is a technology that instead of building a physical machine for each application builds a logical or virtual machine. ...
-
"Take only memories, leave only footprints " The excitement knocked the door of grade 9 students when they were told about the...