Javatpoint Logo
Javatpoint Logo

Program to find reverse of a string

Explanation

In this program, we need to find the reverse of the string. This can be done by iterating the string backward and storing each character from the original string into a new string.

Algorithm

  1. Define a string and another empty string to store the reversed string.
  2. Now, iterate the string from last and store a character from back into variable revString.
  3. At the end of the loop, revString will hold the reverse of the string.

Solution

Python

Output:

Original string: Dream big
Reverse of given string: gib maerD

C

Output:

Original string: Dream big
Reverse of given string: gib maerD

JAVA

Output:

Original string: Dream big
Reverse of given string: gib maerD

C#

Output:

Original string: Dream big
Reverse of given string: gib maerD

PHP

Output:

Original string: Dream big
Reverse of given string: gib maerD

Next Topic#





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA