gabi11

Algorithms - 01. Reverse Array

Sep 7th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Algorithms
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             var symbols = Console.ReadLine().Split(' ').ToArray();
  11.  
  12.             PrintReversedSymbols(symbols, 0);
  13.         }
  14.  
  15.         private static void PrintReversedSymbols(string[] symbols, int index)
  16.         {
  17.             if (index >= symbols.Length)
  18.             {
  19.                 return;
  20.             }
  21.  
  22.             PrintReversedSymbols(symbols, index + 1);
  23.             Console.Write($"{symbols[index]} ");
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment