kirililchev3

Reverse Array of String

Jun 3rd, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.67 KB | None | 0 0
  1. namespace Reverse_Array_of_Strings
  2. {
  3.     using System;
  4.     using System.Linq;
  5.  
  6.     public class Reverse_Array_of_Strings
  7.     {
  8.         public static void Main(string[] args)
  9.         {
  10.             // BOTH VARIATIONS WORK
  11.             string[] input = Console.ReadLine().Split();
  12.             ////for (int i = 0, j = input.Length - 1; i < j && j > i; i++, j--)
  13.             ////{
  14.             ////    string temp = input[i];
  15.             ////    input[i] = input[j];
  16.             ////    input[j] = temp;
  17.             ////}
  18.             ////Console.WriteLine(string.Join(" ", input));
  19.             Console.WriteLine(string.Join(" ", input.Reverse().ToArray()));
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment