Reverse a string using for loop

Venkateshrondi
Posted by Venkateshrondi under C# category on | Points: 40 | Views : 291
using System;
class Reverse
{
static void Main()
{
Console.WriteLine("enter any string ");
string s = Console.ReadLine();
Console.WriteLine();
Console.WriteLine("you have entered "+ " " +"'"+s+"'");
Console.WriteLine();
Console.WriteLine("The reversed string is shown below");
Console.WriteLine();
for(int i=s.Length-1;i>=0;i--)
Console.Write(s[i]);
Console.ReadLine();
}
}

Comments or Responses

Login to post response