Wednesday, October 16, 2019

77. Qbasic program to input any number and display the factors.


77.      Write a sub program to input any number and display the factors.

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

No comments:

Post a Comment