QBASIC PROGRAM TO FIND THE LONGEST STRING

QBASIC PROGRAM TO FIND THE LONGEST STRING



CLS
 INPUT "ENTER FIRST STRING"; A$
 INPUT "ENTER SECOND STRING"; B$
 INPUT "ENTER THIRD STRING"; C$
 IF LEN(A$) > LEN(B$) AND LEN(A$) > LEN(C$) THEN
 G$ = A$
 IF LEN(B$) > LEN(A$) AND LEN(B$) > LEN(C$) THEN
 G$ = B$
 ELSE
 G$ = C$
 END IF
 PRINT "LONGEST STRING="; G$
 END

USING SUB


DECLARE SUB LONG(A$,B$,C$)
 CLS
 INPUT "ENTER FIRST STRING"; A$
 INPUT "ENTER SECOND STRING"; B$
 INPUT "ENTER THIRD STRING"; C$
 CALL LONG(A$,B$,C$)
 END
 
 SUB LONG(A$,B$,C$)
 IF LEN(A$) > LEN(B$) AND LEN(A$) > LEN(C$) THEN
 G$ = A$
 IF LEN(B$) > LEN(A$) AND LEN(B$) > LEN(C$) THEN
 G$ = B$
 ELSE
 G$ = C$
 END IF
 PRINT "LONGEST STRING="; G$
 END SUB

Post a Comment

0 Comments