Reverse the order of words in a sentence

//input: Welcome to Csharp corner, output: corner Csharp to Welcome


string input = "Welcome to Csharp corner";

Console.WriteLine("input: "+ input);


string[] words = input.Split(' ');


Console.Write("\noutput: ");

for (int i = words.Length - 1;i>=0; i--)

{

    Console.Write(words[i]+ ' ');

}


Console.ReadLine();