Saturday, March 10, 2018

Qbasic Program that accepts any 12 names and displays the longest among them.

Qbasic Program  that accepts any 12 names and displays the longest among them.

CLS
DIM n(12) AS STRING
FOR i = 1 TO 12
    INPUT "enter 12 names"; n(i)
NEXT i
a$ = n(1)
FOR j = 2 TO 12
    IF LEN(n(j)) > LEN(a$) THEN a$ = n(j)
NEXT j
PRINT "The longest name is: "; a$



END


1 comment: