Qbasic Program to Print longest and the shortest word among ten different words
Posted by Mahibabu
REM Program to print longest and shortest among ten words
CLS
INPUT "Enter first word "; a$
l$ = a$
s$ = a$
l = LEN(l$)
s = LEN(s$)
FOR i = 2 TO 10
INPUT "Enter next word"; b$
b = LEN(b$)
IF b > l THEN
l$ = b$
l = b
ELSEIF b < s THEN
s$ = b$
s = b
END IF
NEXT i
PRINT "The longest word is "; l$
PRINT "The shortest word is "; s$
END