To Find the Factors of Given Number. (Qbasic Code)

To Find the Factors of Given Number.
  •  CLS
    INPUT "Enter any number"; n
    FOR i = 1 TO n
        x = n MOD i
        IF x = 0 THEN
            PRINT i;
        END IF
    NEXT i
    END
 To Find the Factors of Given Number Using COMMON SHARED.
  • DECLARE SUB factor ()
    COMMON SHARED n
    CLS
    CALL factor
    END

    SUB factor
    INPUT "Enter any number"; n
    FOR i = 1 TO n
        x = n MOD i
        IF x = 0 THEN
            PRINT i;
        END IF
    NEXT i
    END SUB

Share :

Facebook Twitter Google+
Back To Top

facebook main

counter

Powered by Blogger.