Friday, October 25, 2019

QBasic to display factor

CLS 
INPUT "Enter any number";N
FOR I = 1 To N
IF N MOD I = 0 THEN PRINT I
NEXT I
END

QBasic to dislpay prime or composite

CLS
INPUT "ENTER ANY NUMBER"; N
C = 0
FOR I = 1 TO N
IF N MOD I = 0 THEN C = C + 1
NEXT I
IF C = 2 THEN
PRINT N; "IS PRIME NUMBER"
ELSE
PRINT N; "IS COMPOSITE NUMBER"
END IF
END

QBasic to dislpay armstrong or not

CLS
INPUT "Enter a number"; N
A = N

S = 0
WHILE N <> 0

R = N MOD 10
S = S + R ^ 3
N = N \ 10
WEND
IF A= S THEN
PRINT "It is armstrong number";
ELSE
PRINT "It is not armstrong number";
END IF
END

QBasic to find palindrome or not

CLS
INPUT "Enter any number"; N
A = N
S = 0
WHILE N <> 0
R = N MOD 10
S = S * 10 + R
N = N \ 10
WEND
IF A = S THEN
PRINT"the given number is palindrome"
ELSE
PRINT"the given number is not palindrome"
END IF

END

QBasic to find reverse

CLS
INPUT "Enter any number"; N
S = 0
WHILE N <> 0
R = N MOD 10
S = S * 10 + R
N = N \ 10
WEND
PRINT "Reversed digits is "; S
END

QBasic to display 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

QBasic to display sum of digit

CLS
INPUT"Enter any number";N
S=0
WHILE N<>10
R=N MOD 10
S=S+R
N=N\10
WEND
PRINT"Sum of digits";S
END

QBasic to display greater among three number

CLS
INPUT"Enter any number";N
IF A>B and B>C THEN
PRINT"Greater number is";A
ELSE IF B>A and B>C THEN
PRINT"Greater number is";B
ELSE
PRINT"Greater number is";C
END IF 
END

QBasic to dislpay odd or even

CLS
INPUT"Enter any number"N
IF N MOD 2=0 THEN
PRINT"The given number is even"
ELSE
PRINT"The given number is odd"
END IF
END

Thursday, October 24, 2019

QBasic to dislpay positive,Negative or Zero

CLS
INPUT"Enter any number";N
IF N=0 THEN
PRINT"Given number is positive"
ELSE IF N<0 THEN
PRINT"Given number is negative"
ELSE
PRINT"Given number is zero"
END IF
END

QBasic to find volume of cylinder

CLS
IMPUT"Enter radius";r
INPUT"Enter height";h
V=22/7*r^2*h
PRINT"Volume of cylinder=";V
END

Radio wave

 Radio wave     is an electromagnetic wave of a frequency between about   10 4  and 10 11  or 10 12  Hz , as used for long distance communic...