Programming Concept QBASIC: 1. Input any string and reverse it. CLS 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. Input any string and check whether the given string is palindrome or not. CLS INPUT "Enter any word"; 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 word is palindrome" ELSE PRINT "The given word is not a palindrome” END IF END 3. Count total no. of vowels in a given string . CLS 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 C = C + 1 NEXT I PRINT "Total number of vowels= "; C END 4. Count tota
Posts
Showing posts from January, 2016