Question: Define two variables, number of type int to represent a number , and text of type string to represent some text, of at least 2

Define two variables, number of type int to represent a number , and text of type string to represent some text, of at least 20 characters. Their values can be whatever you feel best represents your program's features. Use of string methods is acceptable, and should always be assumed to be less than the number of characters in the text. Write a program that: a. Prints the first characters of the text. b. Prints the first and last characters of the text. c. Identifies the character of the text, and replaces all characters of the same value with the character X, printing the result. d. Prints the middle characters if the number of characters in the text has the same parity as . Otherwise, print the middle characters. Note: The first character of the string 'example' is 'e', the second character is 'x', the middle three characters are 'amp'.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!