How to reverse a string :

class Program

{
static void Main(string[] args)
{
string reverseName = ” “;
Console.WriteLine(“Please give an input :”);
string fullName = Console.ReadLine();   //Take user input.

for (int index = fullName.Length – 1; index >= 0; index–)
{
reverseName = reverseName + fullName[index];
}

    Console.WriteLine(reverseName);
Console.ReadLine();
}
}
Input :       I am a student.
Output :    .tneduts a ma I

Leave a Reply