- 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();
- }
- }
Reverse Words of a String in C#
In this article, I explain how to reverse full string content with the help of c#.


Maitrey PatelPosted Sep 23, 2019, 10:23 PM EDT
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 23, 2019, 10:22 PM EDT
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, 1:37 AM EST
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, 8:54 AM EDT
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.