- 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();
- }
- }
- }
We have a sentence. We want to reverse the word from given sentences as well as reverse sentence with reverse letters. See below program.
