Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class ReverseString
- {
- static void Main()
- {
- string input = Console.ReadLine();
- ////Using the build-in reverse method
- //char[] inputChars = input.ToCharArray();
- //Array.Reverse(inputChars);
- //Console.WriteLine(new string (inputChars));
- //Without using the build-in reverse method
- char[] inputChars = input.ToCharArray();
- StringBuilder sb = new StringBuilder();
- for (int i = input.Length - 1; i >= 0; --i)
- {
- sb.Append(inputChars[i]);
- }
- Console.WriteLine(sb.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement