public void StringReverse()
{
string str = "stringtoberevered";
char[] chararr = new char[str.Length];
chararr = str.ToCharArray();
Console.Write("The Reversed String = ");
for (int i = str.Length - 1; i >= 0; i--)
{
Console.Write(chararr[i]);
}
Console.WriteLine();
}
Output: dereverebotgnirts
No comments:
Post a Comment