Reverse the Words and Letter in Sentence using C# Programming
namespace Reverse_Sentences{
class Program
{
static void Main(string[] args)
{
string word;
Console.Write("Enter Your Sentence:");
word = Console.ReadLine();
string[] splstring = word.Split(' ');
for (int i = splstring.Length - 1; i >= 0; i--)
{
Console.Write(splstring[i] + ' ');
}
Console.WriteLine();
for (int i = splstring.Length - 1; i >= 0; i--)
{
char[] splchar = splstring[i].ToCharArray();
for (int j = splchar.Length - 1; j >= 0; j--)
{
Console.Write(splchar[j]);
}
Console.Write(' ');
}
Console.ReadLine();
}
}
}
