December 30, 2016

Qbasic program to check the entered number is Prime or Composite.

CLS
INPUT "Enter a number:", A
FOR I = 1 TO A
IF A MOD I = 0 THEN C = C + 1
NEXT I
IF C = 2 THEN
PRINT "The number is Prime."
ELSE
PRINT "The number is Composite."
END IF
END

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.