Reverse a string without using any function.

Sumank
Posted by Sumank under C# category on | Points: 40 | Views : 977
Reverse String

class StringReverse
{
static void Main()
{
string Str, Revstr = null;
Console.WriteLine("Enter string");
Str=Console.ReadLine();
for (int i = 1; i <= Str.Length; i++)
{
Revstr = Revstr + Str[Str.Length - i];
}
Console.WriteLine("Reverse string is {0}", Revstr);
}
}

Comments or Responses

Login to post response