To print the prime number from 1 to 100.

CLS
FOR i = 2 TO 100
    FOR j = 2 TO i - 1
        IF i MOD j = 0 THEN GOTO a:
    NEXT j
    PRINT i;
    a:
NEXT i
END

Next Method 
  • CLS
    FOR i = 1 TO 100
        c = 0
        FOR j = 1 TO i
            x = i MOD j
            IF x = 0 THEN c = c + 1
        NEXT j
        IF c = 2 THEN
            PRINT i
        END IF
    NEXT i
    END

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.