Site icon Pathshala Nepal

Write a function procedure to input three different strings and find the longest string.

Modular programming
Online Calculator

Write a function procedure to input three different strings and find the longest string.


1 Answer


DECLARE FUNCTION LON$ (A$, B$, C$)
CLS
INPUT "ENTER THREE STRINGS:"; A$, B$, C$
PRINT "THE LONGEST STRING=";LON$ (A$, B$, C$)
END

FUNCTION LON$ (A$, B$, C$)
A = LEN (A$)
B = LEN (B$)
C = LEN (C$)
IF A > B AND A > C THEN S$ = A$
IF B > A AND B > C THEN S$ = B$
IF C > A AND C > B THEN S$ = C$
LON$ = S$
END FUNCTION 

Topics from Computer
Related Questions