Let us proceed and create a sample program to understand the logic to implement the same.
Write the below code in a console application.
- static void Main(string[] args)
- {
- string _Inputstr = string.Empty, _Reversestr = string.Empty;
- Console.Write("Enter the string : ");
- _Inputstr = Console.ReadLine();
- for (inti = _Inputstr.Length - 1; i >= 0; i--)
- {
- _Reversestr += _Inputstr[i];
- }
- Console.WriteLine("The reverse string is {0}", _Reversestr);
- Console.ReadLine();
- }
Output


Sourabh HawalPosted Mar 26, 2022, 12:38 PM
Please give explanation sir
Sourabh HawalPosted Mar 26, 2022, 12:36 PM
Very good sir