Morning Guys,
I am trying to reverse the sentence...for eg,if the user types in "The Rain in Spain",then the output should be "Spain in Rain The"!!!How can i do it?
see my code below...What did i do wrong?
string str, RevStr = "";
Console.WriteLine("Enter a sentence you wish to reverse : ");
str = Console.ReadLine();
for(int x = str.Length - 1;x >= 0; x--)
{
RevStr = RevStr + str[x];
}
Console.WriteLine("Reverse string is : {0}", RevStr);
Console.ReadLine();