Wednesday, October 2, 2019

PRIME OR COMPOSITE USING SUB

DECLARE SUB CHECK()
CLS
INPUT"ENTER ANY NO";N
CALL CHECK(N)
END

SUB CHECK(N)
C=0
FOR I=1 TO N
IF N MOD I=0 THEN C=C+1
NEXT I
IF C=2 THEN
PRINT"PRIME NO"
ELSE
PRINT"COMPOSITE NO"
END IF
END SUB

No comments:

Post a Comment

My JM Experience

School life is very important part of one's life, because it provides opportunity for study and discipline. Besides these, the scho...