128.
Write a program to print the shortest word among the three different
word input by the user using FUNCTION…….END FUNCTION.
DECLARE FUNCTION SHRT$( A$, B$, C$)
CLS
INPUT "ENTER FIRST STRING"; A$
INPUT "ENTER SECOND STRING"; B$
INPUT "ENTER THIRD STRING"; C$
PRINT "SHORTEST STRING="; SHRT$( A$, B$, C$)
END
FUNCTION SHRT$( A$, B$, C$)
IF LEN(A$) < LEN(B$) AND LEN(A$) < LEN(C$) THEN
S$ = A$
IF LEN(B$) < LEN(A$) AND LEN(B$) < LEN(C$) THEN
S$ = B$
ELSE
S$ = C$
END IF
SHRT$ = S$
END FUNCTION
No comments:
Post a Comment