0

c# question

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 x=Console.ReadLine(); string[] y= x.Split(' '); foreach (var word in y) { for (int i=1; i<word.Length; i++) { Console.Write (word[i]); } Console.Write (word[0]); Console.Write ("ay "); } } } } I'm interested in how to make 2 letters, not 1, appear after the word. Example: ball displays allbay, but I wonder how to make llabay be displayed. Console.Write (word [0]); Console.Write (word [1]); Does not help.

26th Mar 2020, 2:06 PM
GAG98
GAG98 - avatar
4 Answers
+ 1
Here is an example based on your code https://code.sololearn.com/cWj96nC0N1wF/?ref=app if you want to reverse the letters please give me a sign
26th Mar 2020, 2:45 PM
Gabriel Ilie
Gabriel Ilie - avatar
0
foreach (var word in y) { for (int i=2; i<word.Length; i++) { Console.Write (word[i]); } Console.Write(word[1]); Console.Write(word[0]); Console.Write ("ay "); Is this not working?
26th Mar 2020, 2:46 PM
Jayakrishna 🇼🇳
0
Everything works.
26th Mar 2020, 9:14 PM
GAG98
GAG98 - avatar
0
Strange, I did it, but it didn’t work out for me.
26th Mar 2020, 9:17 PM
GAG98
GAG98 - avatar