PERFECT NUMBER, PERFECT SQUARE NUMBER, MULTIPLICATION NUMBER, HCF AND LCM QBASIC PROGRAMS
136. WAP TO CHECK WHETHER THE INPUT NUMBER IS PERFECT NUMBER OR NOT.
CLS
INPUT "ENTER ANY NUMBER"; N
S = 0
FOR I = 1 TO N - 1
IF N MOD I = 0 THEN S = S + I
NEXT I
IF S = N THEN
PRINT "PERFECT NUMBER"
ELSE
PRINT "NOT PERFECT NUMBER"
END IF
END
USING SUB PROCEDURE
DECLARE SUB PERFECT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL PERFECT (N)
END
SUB PERFECT (N)
S = 0
FOR I = 1 TO N - 1
IF N MOD I = 0 THEN S = S + I
NEXT I
IF S = N THEN
PRINT "PERFECT NUMBER"
ELSE
PRINT "NOT PERFECT NUMBER"
END IF
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION PERFECT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PR = PERFECT (N)
IF PR = N THEN
PRINT "PERFECT NUMBER"
ELSE
PRINT "NOT PERFECT NUMBER"
END IF
END
FUNCTION PERFECT (N)
S = 0
FOR I = 1 TO N - 1
IF N MOD I = 0 THEN S = S + I
NEXT I
PERFECT = S
END FUNCTION
137. WAP TO CHECK WHETHER THE INPUT NUMBER IS PERFECT SQUARE NUMBER OR NOT.
CLS
INPUT "ENTER ANY NUMBER"; N
S = SQR(N)
IF S = INT(S) THEN
PRINT "PERFECT SQUARE"
ELSE
PRINT "NOT PERFECT SQUARE"
END IF
END
USING SUB PROCEDURE
DECLARE SUB PERFECT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL PERFECT (N)
END
SUB PERFECT (N)
S = SQR(N)
IF S = INT(S) THEN
PRINT "PERFECT SQUARE"
ELSE
PRINT "NOT PERFECT SQUARE"
END IF
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION PERFECT (S)
CLS
INPUT "ENTER ANY NUMBER"; N
S = SQR(N)
PR = PERFECT (S)
IF PR = S THEN
PRINT "PERFECT SQUARE"
ELSE
PRINT "NOT PERFECT SQUARE"
END IF
END
FUNCTION PERFECT (S)
PERFECT = INT (S)
END FUNCTION
137. WAP TO DISPLAY MULTIPLICATION TABLE OF A GIVEN NUMBER.
CLS
INPUT "ENTER ANY NUMBER"; N
FOR I = 1 TO 10
PRINT N; "X"; I; "="; N * I
NEXT I
END
USING SUB PROCEDURE
DECLARE SUB MUL (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL MUL (N)
END
SUB MUL (N)
FOR I = 1 TO 10
PRINT N; "X"; I; "="; N * I
NEXT I
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION MUL (N)
CLS
INPUT "ENTER ANY NUMBER"; N
M = MUL(N)
END
FUNCTION MUL (N)
FOR I = 1 TO 10
PRINT N; "X"; I; "="; N * I
NEXT I
END FUNCTION
137. WAP TO DISPLAY H.C.F AND L.C.M OF A GIVEN ANY TWO NUMBERS.
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT "H.C.F="; B
PRINT "L.C.M="; L
END
USING SUB PROCEDURE
DECLARE SUB HCFLCM(A, B)
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
CALL HCFLCM (A, B)
END
SUB HCFLCM (A, B)
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT "H.C.F="; B
PRINT "L.C.M="; L
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION HCFLCM(A, B)
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
PRINT “L.C.M=”; HCFLCM (A, B)
END
FUNCTION HCFLCM (A, B)
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT "H.C.F="; B
HCFLCM = L
END FUNCTION
138. WAP TO DISPLAY H.C.F OF A GIVEN ANY TWO NUMBERS.
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
PRINT "H.C.F="; B
END
USING SUB PROCEDURE
DECLARE SUB HCF(A, B)
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
CALL HCF (A, B)
END
SUB HCF (A, B)
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
PRINT "H.C.F="; B
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION HCF(A, B)
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
PRINT “H.C.F=”; HCF (A, B)
END
FUNCTION HCF (A, B)
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
HCF = B
END FUNCTION
139. WAP TO DISPLAY L.C.M OF A GIVEN ANY TWO NUMBERS.
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT "L.C.M="; L
END
USING SUB PROCEDURE
DECLARE SUB LCM(A, B)
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
CALL LCM (A, B)
END
SUB LCM (A, B)
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
PRINT "L.C.M="; L
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION LCM(A, B)
CLS
INPUT "ENTER ANY TWO NUMBERS"; A, B
PRINT “L.C.M=”; LCM (A, B)
END
FUNCTION LCM (A, B)
C = A
D = B
WHILE A MOD B < > 0
T = A MOD B
A = B
B = T
WEND
L = C * D / B
LCM = L
END FUNCTION
Comments
(And realistically, it is not related to genetics or some hard exercise and EVERYTHING to do with "HOW" they are eating.)
BTW, I said "HOW", and not "WHAT"...
Click this link to see if this short test can help you decipher your true weight loss potential