Read three sentences from the console application. Each sentence should not exceed 80 characters. Then, copy each character in each input sentence in a [3 x 80] character array. The first sentence should be loaded into the first row in the reverse order of characters – for example, “mary had a little lamb” should be loaded into the array as “bmal elttil a dah yram”. The second sentence should be loaded into the second row in the reverse order of words – for example, “mary had a little lamb” should be loaded into the array as “lamb little a had mary”. The third sentence should be loaded into the third row where if the index of the array is divisible by 5, then the corresponding character is replaced by the letter ‘z’ – for example, “mary had a little lamb” should be loaded into the array as “mary zad azlittze lazb” – that is, characters in index positions 5, 10, 15, and 20 were replaced by ‘z’. Note that an empty space is also a character, and that the index starts from position 0. Now print the contents of the character array on the console. Program is written as per the application programming interface (API) attached

In this console application, we are required to read three input sentences and store them in a character array of size [3 x 80]. The first sentence should be loaded into the first row of the array in reverse order of characters. The second sentence should be loaded into the second row in reverse order of words, and the third sentence should be loaded into the third row such that any character in the array whose index is divisible by 5 is replaced with the letter ‘z’.

To begin, we will read the three input sentences from the console. Each sentence should not exceed 80 characters. Let’s assume the three sentences are as follows:

1. “Mary had a little lamb.”
2. “The quick brown fox jumps over the lazy dog.”
3. “Lorem ipsum dolor sit amet, consectetur adipiscing elit.”

Next, we will create a character array of size [3 x 80] to store the input sentences. The first sentence will be loaded into the first row of the array in reverse order of characters. So, “Mary had a little lamb.” becomes “bmal elttil a dah yraM.” The second sentence will be loaded into the second row in reverse order of words. So, “The quick brown fox jumps over the lazy dog.” becomes “dog. lazy the over jumps fox brown quick The.” Lastly, the third sentence will be loaded into the third row, with any character whose index is divisible by 5 replaced with ‘z’. So, “Lorem ipsum dolor sit amet, consectetur adipiscing elit.” becomes “Lorem zpsum zolor zit azet, cozzectetur adipisicing elit.”

Finally, we need to print the contents of the character array on the console. This can be done by iterating through each element of the array and displaying it on the console. The resulting character array would look like this:

b m a l e l t t i l a d a h y r a M
d o g . l a z y t h e o v e r j u m p s f o x b r o w n q u i c k T h e
L o r e m z p s u m z o l o r z i t a z e t , c o z z e c t e t u r a d i p i s c i n g e l i t .

When printed on the console, the above character array would look like the following:

bmal elttil a dah yraM
dog. lazy the over jumps fox brown quick The
Lorem zpsum zolor zit azet, cozzectetur adipisicing elit.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer