QBASIC PROGRAM TO CALCULATE TOTAL NO. OF SENTENCES IN A STRING

QBASIC PROGRAM TO CALCULATE TOTAL NO. OF SENTENCES IN A STRING



CLS
 INPUT "ENTER ANY STRING"; S$
 SC = 0
 FOR I = 1 TO LEN(S$)
 B$ = MID$(S$, I, 1)
 IF B$ =   THEN
 SC = SC + 1
 END IF
 NEXT I
 PRINT "TOTAL NO. OF SENTENCES= "; SC
 END

USING SUB


DECLARE SUB SENTENCE(S$)
 CLS
 INPUT "ENTER ANY STRING"; S$
 SC = 0
 FOR I = 1 TO LEN(S$)
 B$ = MID$(S$, I, 1)
 IF B$ =   THEN
 SC = SC + 1
 END IF
 NEXT I
 PRINT "TOTAL NO. OF SENTENCES= "; SC
 END SUB

Post a Comment

0 Comments