Connect Me

twitterfacebookgoogle plus email

  Instagram View Biwas Bhattarai's profile on LinkedIn

WAP to enter a number from a keyboard and check and print whether the number is PRIME or COMPOSITE.

DECLARE SUB PRCOM(N)
CLS
INPUT "ENTER A NUMBER"; N
CALL PRCOM(N)
END

SUB PRCOM(N)
FOR I=1 TO N
IF N MOD I=0 THEN C=C+1
NEXT I
IF C=2 THEN 
PRINT "SUPPLIED NUMBER IS A PRIME NUMBER"
ELSE
PRINT "SUPPLIED NUMBER IS A COMPOSITE NUMBER"
END IF
END SUB
Ą
https://www.flickr.com/photos/spklg/15211044551/