Best answer will be marked as the brainliest how to do this questionwrite a program in QBASIC that accepts a number and checks whether it is a prime number or not..
Answers
Answered by
4
CLS
INPUT "enter a number"; Num
basic =0
FOR Prime = 1 TO Num
IF Num MOD Prime = 0 THEN basic = basic + 1
NEXT Prime
IF basic = 2 THEN
PRINT "Is a prime number";
ELSE
PRINT "Is not a prime number";
END IF
END
Hope this helps!
INPUT "enter a number"; Num
basic =0
FOR Prime = 1 TO Num
IF Num MOD Prime = 0 THEN basic = basic + 1
NEXT Prime
IF basic = 2 THEN
PRINT "Is a prime number";
ELSE
PRINT "Is not a prime number";
END IF
END
Hope this helps!
Attachments:
siddhartharao77:
:-)
Similar questions