+ 8

I have solved the extra terrestrials code coach problem in c++ and python. Any Idea of how I can solve it in C#

11th Sep 2020, 9:28 PM
☃️🎄Abasiono Mbat☃️🎄
☃️🎄Abasiono Mbat☃️🎄 - avatar
9 Respuestas
+ 3
In the same as you done it c++, Py.. Try and share your tried code if you struck..
11th Sep 2020, 9:34 PM
Jayakrishna 🇮🇳
+ 7
Strings have no reverse function so I wanted to turn it to a char Array, then print as a new string
12th Sep 2020, 11:04 AM
☃️🎄Abasiono Mbat☃️🎄
☃️🎄Abasiono Mbat☃️🎄 - avatar
+ 5
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) { // Get the input string character = Console.ReadLine(); // Turn it to an array character = character.ToCharArray(); //Reverse it character = character.Reverse(character); //And bring it as output Console.WriteLine(new string(character)); } } }
11th Sep 2020, 9:47 PM
☃️🎄Abasiono Mbat☃️🎄
☃️🎄Abasiono Mbat☃️🎄 - avatar
+ 4
That's the code
11th Sep 2020, 9:47 PM
☃️🎄Abasiono Mbat☃️🎄
☃️🎄Abasiono Mbat☃️🎄 - avatar
+ 3
Jayakrishna Thanks
13th Sep 2020, 7:18 AM
☃️🎄Abasiono Mbat☃️🎄
☃️🎄Abasiono Mbat☃️🎄 - avatar
+ 2
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) { // Get the input string character = Console.ReadLine(); // Turn it to an array //You need to store in character array so char[] chars = character.ToCharArray(); //Reverse it //Array class has method to reverse array i.e Array.Reverse(chars); //now you have reversed array, make it to a string back //And bring it as output Console.WriteLine(new string(chars)); } } }
11th Sep 2020, 10:30 PM
Jayakrishna 🇮🇳
+ 2
It worked perfectly
14th Sep 2020, 8:27 PM
☃️🎄Abasiono Mbat☃️🎄
☃️🎄Abasiono Mbat☃️🎄 - avatar
+ 1
You're turning into a array but how can you store in string? You need to store in character array.. So char[] ch = character.ToCharArray(); Can you explain next what you are trying? String has no reverse function...
11th Sep 2020, 10:25 PM
Jayakrishna 🇮🇳
+ 1
Abasiono Mbat ok. I understood and gave the correct code above.. With explanation added in comments... Is that not working?
12th Sep 2020, 8:35 PM
Jayakrishna 🇮🇳