Computer Science, asked by anurodh789, 9 months ago

a qbasic program to print composite number from 1 to 100​

Answers

Answered by ARSHSINGHDHILLON
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 Aarambha2064
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