Write a QB program to accept a number from the user and check whether it is prime or composite using [DO WHILE….] loop.
Answers
Answered by
11
Answer:
CLS
INPUT "ENTER A NUMBER"; N
FOR I = 2 TO N / 2
IF N MOD I = 0 THEN
C = C + 2
END IF
NEXT I
IF C > 0 THEN
PRINT "IT IS COMPOSITE"
ELSE
PRINT "IT IS PRIME"
END IF
END
Similar questions