To Find The Greatest Number From N Number Supplied (Qbasic Code)

To Find The Greatest Number From N Number Supplied (Qbasic Code)

CLS
c = 1
h=0
INPUT "How many numbers do you want to enter"; n
FOR i = 1 TO n
    INPUT "Enter the number"; x
    IF x > h THEN
        h = x
    ELSE
    END IF
NEXT i
PRINT "The highest number is"; h
END

Next Method  Using WHILE .... WEND
  •  CLS
    g = 0
    c = 1
    INPUT "Enter how many numbers you want to find"; t
    WHILE c <= t
        INPUT "Enter the numbers"; n
        IF n > g THEN
            g = n
        END IF
        c = c + 1
    WEND
    PRINT "The greatest number among supplied numbers is "; g
    END

Share :

Twitter
Back To Top

facebook main

counter

Powered by Blogger.