+ 1
Why can't this code turn this string backwards ?
I tried to turn a word backwards using this code, but it doesn't turn it backwards. The code just displays the word I wrote. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { string Name = "joseph"; char[] reverse = Name.ToCharArray(); Array.Reverse(reverse); string Reversedname = new string(Name); Console.WriteLine(Reversedname); } } }
1 Respuesta
+ 1
Joseph Oritseweyinmi
You are printing original String.
Convert reversed character array to String and print that.
string Reversedname = new string(reverse);