Program to reverse every words in a sentence | faceprep

Program to reverse every words in a sentence | faceprep

The program to reverse every word in a sentence using recursion is discussed here. Input the sentence from the user and call the function to reverse every word in the sentence. Each word in the sentence is identified and they are reversed and printed. The end of the word is identified by a ” “. If this space is identified in the input, the characters up to that space are reversed and printed. The same procedure is followed until the entire sentence is scanned.


Program to Reverse Every Words in a Sentence

For example,

Input: Program to reverse a sentence using recursion

Output: margorP ot esrever ecnetnes gnisu noisrucer


Program to Reverse Every Words in a Sentence

Program to reverse every word in a sentence

@@coding::1@@

Time complexity: O(n)



Program to Reverse Every Words in a Sentence


c