Advertisement
Qrist

Reversed Chars

Mar 29th, 2020
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Unknown
  4. {
  5.     class Program
  6.     {  
  7.        
  8.         static void Main(string[] args)
  9.         {
  10.             string s = Reverse("ABC");
  11.             Console.WriteLine(s);
  12.  
  13.         }
  14.         public static string Reverse(string text)
  15.         {
  16.             char[] cArray = text.ToCharArray();
  17.             string reverse = String.Empty;
  18.             for (int i = cArray.Length - 1; i > -1; i--)
  19.             {
  20.                 reverse += cArray[i];
  21.             }
  22.             return reverse;
  23.         }
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement