This C# Program reverses a string by picking characters one by one from the end of string till it reaches the first character and add it to the temp string.
namespace ReverseString { class Program { string sample; string temp = null; static void Main(string[] args) { Program p1 = new Program(); p1.input(); Console.ReadLine(); } public void input() { Console.WriteLine("Enter a String"); sample = Console.ReadLine(); for (int i = sample.Length - 1; i >= 0; i--) { temp += sample[i]; } Console.WriteLine("Reverse String ::" + temp); } } }
OUTPUT