Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2018
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06.Reverse_Array_of_Strings
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             string text = Console.ReadLine();
  11.             string[] reversedText = text.Split(' ');
  12.            
  13.             for (int index = 0; index < reversedText.Length / 2 ; index++)
  14.             {
  15.                 var temp = reversedText[index];
  16.                 reversedText[index] = reversedText[reversedText.Length - index - 1];
  17.                 reversedText[reversedText.Length - index - 1] = temp;
  18.             }
  19.            
  20.             for (int index = 0; index < reversedText.Length; index++)
  21.             {
  22.                 Console.Write($"{reversedText[index]} ");
  23.             }
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement