QBasic Programming

WAP to input any number and display the factors

CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "FACTORS OF"; N; "=";
FOR I = 1 TO N
IF N MOD I = 0 THEN PRINT I;
NEXT I
END

USING SUB PROCEDURE

DECLARE SUB FACT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL FACT (N)
END

SUB FACT (N)
PRINT "FACTORS OF"; N; "=";
FOR I = 1 TO N
IF N MOD I = 0 THEN PRINT I;
NEXT I
END SUB

WAP to input number and check whether the given no. composite or not (Prev Lesson)
(Next Lesson) WAP to input any number and display the prime factors
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!