PROJECT WORK
Programming Concept
QBASIC with Output:
1) WAP to enter any string and reverse it.
CLS
PRINT "DOLKAR"
INPUT "ENTER ANY WORD"; A$
FOR I = LEN(A$) TO 1 STEP -1
B$ = MID$(A$, I, 1)
C$ = C$ + B$
NEXT I
PRINT "REVERSED WORD="; C$
END
2) WAP to enter any string and check whether the given string is palindrome or not.
CLS
PRINT "DOLKAR"
INPUT "ENTER ANY STRING"; A$
FOR I = LEN(A$) TO 1 STEP -1
B$ = MID$(A$, I, 1)
C$ = C$ + B$
NEXT I
IF A$ = C$ THEN
PRINT "THE GIVEN STRING IS PALINDROME"
ELSE
PRINT "THE GIVEN STRING IS NOT PALINDROME"
END IF
END
PRINT "DOLKAR"
INPUT "ENTER ANY STRING"; A$
FOR I = LEN(A$) TO 1 STEP -1
B$ = MID$(A$, I, 1)
C$ = C$ + B$
NEXT I
IF A$ = C$ THEN
PRINT "THE GIVEN STRING IS PALINDROME"
ELSE
PRINT "THE GIVEN STRING IS NOT PALINDROME"
END IF
END
3) WAP to display the shortest word among three numbers.
CLS
PRINT "DOLKAR"
INPUT "ENTER ANY WORD"; A$
INPUT "ENTER ANY WORD"; B$
INPUT "ENTER ANY WORD"; C$
IF LEN(A$) < LEN(B$) AND LEN(A$) < LEN(C$) THEN
PRINT A$; "IS SHORTEST WORD"
ELSEIF LEN(B$) < LEN(A$) AND LEN(B$) < LEN(C$) THEN
PRINT B$; "IS SHORTEST WORD"
ELSE
PRINT C$; "IS SHORTEST WORD"
END IF
END
CLS
PRINT "DOLKAR"
INPUT "ENTER ANY STRING"; A$
FOR I = 1 TO LEN(A$)
B$ = MID$(A$, I, 1)
IF I MOD 2 = 0 THEN
C$ = C$ + LCASE$(B$)
ELSE
C$ = C$ + UCASE$(B$)
END IF
NEXT I
PRINT "ALTERNATE CASE="; C$
END
CLS
PRINT "DOLKAR"
INPUT "ENTER ANY STRING"; A$
B$ = UCASE$(LEFT$(A$, 1))
FOR I = 1 TO LEN(A$)
C$ = MID$(A$, I, 1)
IF C$ = "" THEN
B$ = B$ + "." + UCASE$(MID$(A$, I + 1, 1))
END IF
NEXT I
PRINT B$
END
6) WAP to enter any word and find total no of consonant.
CLS
PRINT "DOLKAR"
INPUT "ENTER ANY WORD"; A$
FOR I = 1 TO LEN(A$)
B$ = MID$(A$, I, 1)
C$ = UCASE$(B$)
IF C$ <> "A" AND C$ <> "E" AND C$ <> "I" AND C$ <> "O" AND C$ <> "U" THEN C = C + 1
NEXT I
PRINT "TOTAL NO. OF CONSONANT="; C
PRINT "DOLKAR"
INPUT "ENTER ANY WORD"; A$
FOR I = 1 TO LEN(A$)
B$ = MID$(A$, I, 1)
C$ = UCASE$(B$)
IF C$ = "A" OR C$ = "E" OR C$ = "I" OR C$ = "O" OR C$ = "U" THEN PRINT B$
NEXT I
END
CLS
PRINT "DOLKAR"
INPUT "ENTER ANY WORD"; A$
FOR I = 1 TO LEN(A$)
B$ = MID$(A$, I, 1)
C$ = UCASE$(B$)
IF C$ <> "A" AND C$ <> "E" AND C$ <> "I" AND C$ <> "O" AND C$ <> "U" THEN C = C + 1
NEXT I
PRINT "TOTAL NO. OF CONSONANT="; C
END
7)WAP to enter any word and to display vowels only.
CLSPRINT "DOLKAR"
INPUT "ENTER ANY WORD"; A$
FOR I = 1 TO LEN(A$)
B$ = MID$(A$, I, 1)
C$ = UCASE$(B$)
IF C$ = "A" OR C$ = "E" OR C$ = "I" OR C$ = "O" OR C$ = "U" THEN PRINT B$
NEXT I
END
Comments
Post a Comment