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.
Original string: Dream big
Reverse of the string: big maerD
Algorithm
- Define a string and another empty string to store the reversed string.
- Now, iterate the string from last and store a character from back into variable revString.
- At the end of the loop, revString will hold the reverse of the string.
Input:
string = "Dream big"
Output:
Original string: Dream big
Reverse of given string: gib maerD
Python
Output:
C
Output:
JAVA
Output:
C#
Output:
PHP
Output: