Answer to Question #325789 in C# for chi

Question #325789

6.10.

Write a program that takes data, a word at a time and reverses the words of the line.


Sample input/output dialogue: Input string value: birds and bees

Reversed: bees and birds


1
Expert's answer
2022-04-09T17:55:13-0400
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Input string value: ");
            string words = Console.ReadLine();
            string[] s = words.Split(' ');
            Array.Reverse(s);
            string result = string.Join(" ", s);
            Console.WriteLine("Reversed: {0}", result);
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS