encho253

Untitled

Jun 28th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. namespace ConsoleApp1
  2. {
  3.     public class Program
  4.     {
  5.         static void Main()
  6.         {
  7.  
  8.             string text = "Hello World!";
  9.             Console.WriteLine(Rec(text));
  10.  
  11.             string Rec(string msg)
  12.             {
  13.                 if (msg.Length <= 1)
  14.                 {
  15.                     return msg;
  16.                 }
  17.  
  18.                 char a = msg[0];
  19.  
  20.                 return Rec(msg.Substring(1)) + a;
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment