- class Program
- {
- static void Main(string[] args)
- {
- string text = "I am human being";
- char[] cArray = text.ToCharArray();
- string reverse = String.Empty;
- for (int i = cArray.Length - 1; i > -1; i--)
- {
- reverse += cArray[i];
- }
- Console.WriteLine(reverse);
- Console.ReadLine();
- }
- }
4 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.

Maitrey PatelPosted Sep 24, 2019, 2:23 AM
String s = Console.ReadLine(); string[] a = s.Split(' '); int k = a.Length - 1; for (int i = k; k >= 0; k--) Console.Write(a[k] + ' ');
Maitrey PatelPosted Sep 24, 2019, 2:22 AM
String s = Console.ReadLine(); string[] a = s.Split(' '); int k = a.Length - 1; for (int i = k; k >= 0; k--) Console.Write(a[k] + ' ');
Muhammad BakhtyarPosted Dec 29, 2018, 6:37 AM
I have a little confusion. Can you tell me why you have put "" + '' while printing the reverse aray in first example?
Sam HobbsPosted Apr 27, 2013, 12:54 PM
In the first example, instead of the "for" loop you can use string.Join to create the new string. For the example, you will want to set the color before writing the string.