QBasic Programming

WAP to enter any ten strings and display the longest strings

CLS
INPUT "ENTER FIRST STRING"; A$
FOR I = 2 TO 10
INPUT "ENTER NEXT STRING"; B$
IF LEN(B$) > LEN(A$) THEN A$ = B$
NEXT I
PRINT "LONGEST STRING="; A$
END

USING SUB PROCEDURE
DECLARE SUB LON( A$ )
CLS
INPUT "ENTER FIRST STRING"; A$
CALL LON (A$)
END
SUB LON (A$)
FOR I = 2 TO 10
INPUT "ENTER NEXT STRING"; B$
IF LEN(B$) > LEN(A$) THEN A$ = B$
NEXT I
PRINT "LONGEST STRING="; A$
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION LON$( A$ )
CLS
INPUT "ENTER FIRST STRING"; A$
PRINT "LONGEST STRING=";  LON (A$)
END
FUNCTION LON (A$)

FOR I = 2 TO 10
INPUT "ENTER NEXT STRING"; B$
IF LEN(B$) > LEN(A$) THEN A$ = B$
NEXT I
LON$ = A$
END FUNCTION

WAP to check whether the supplied character is alphabet or not (Prev Lesson)
(Next Lesson) WAP to enter any ten strings and display the shortest string
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!