a qbasic program to print composite number from 1 to 100
Answers
Answered by
8
Answer:
CLS
FOR N = 1 TO 100
C = 0
FOR I = 1 TO N
IF N MOD I = 0 THEN C = C + 1
NEXT I
IF C = 2 THEN PRINT N,
NEXT N
END
USING SUB PROCEDURE
DECLARE SUB COMPOSITE ( )
CLS
CALL COMPOSITE
END
SUB COMPOSITE
FOR N = 1 TO 100
C = 0
FOR I = 1 TO N
IF N MOD I = 0 THEN C = C + 1
NEXT I
IF C = 2 THEN PRINT N,
NEXT N
END SUB
Explanation:
Answered by
0
Answer:
CLS
FOR I = 1 TO 100
FOR J = 2 TO I
IF I <> J AND I MOD J = 0 THEN
PRINT I,
GOTO 9
END IF
NEXT J
9: NEXT I
END
Similar questions
Science,
5 months ago
Social Sciences,
5 months ago
Math,
5 months ago
Math,
11 months ago
Physics,
1 year ago