Computer Science, asked by pranavpratibha9, 11 months ago

write a program to print the prime numbers from 1 to 50. in qbasic . also explain it ​ please

Answers

Answered by sandhutanvirsingh
2

Script:

REM Program to print all prime numbers from 1 to 100

CLS

FOR n = 2 TO 100

FOR k = 2 TO n / 2

flag = 0

r = n MOD k

IF r = 0 THEN

flag = 1

EXIT FOR

END IF

NEXT k

IF flag = 0 THEN PRINT n,

NEXT n

END

Similar questions