You are on page 1of 2

(Strings)

Computer Programming

Program#1:
Write a program that takes a string as input from user then prints whether it is palindrome or not.
(Palindrome is a type of word play in which a word, phrase, or sentence reads the same
backward or forward)
Output
Enter a string
no evil shahs live on
The given string is a Palindrome string

Program#2:
Write a program that inputs a string, a sub-string and location (where user wants to add
substring) and then inserts the substring to the location provided by the user.
Output
Enter a string:
Pleases this application and give me gratuity
Enter Substring: read
Location : 7
After inserting substring final output is
Pleases read this application and give me gratuity

Program#3:
Write a program that takes two strings as input from user then prints whether both strings are
equal or not without using built-in function of strcmp().
Output
Enter first string:
He that lives upon hope will die fasting
Enter second string:
He that lives upon hope will die fasting
The given strings are equal

Program#4:
Write a program that takes a string and a character from user as input then remove that character
from the string and print the final string.
Output

Enter the string:


He that lives upon hope will die fasting
Enter the character you want to remove: i
Final string after removing i is:
He that lves upon hope wll de fastng

Program#5:
Write a program that takes a string as input then replaces all words of is by was.
Output
Enter the string:
This blue pen is for the kid, which is wearing blue shirt and is looking healthy.
Final string after replacement is:
This blue pen was for the kid, which was wearing blue shirt and was looking healthy.

_________________

You might also like