Easy csharp

Reverse a string

Problem

Reverse the string "Toolliyo" and print result.

Hints
  • ToCharArray() + Array.Reverse()

Your practice code

Ready — edit the code above and click Run.

Solution

using System;

class Program
{
    static void Main()
    {
        string s = "Toolliyo";
        char[] chars = s.ToCharArray();
        Array.Reverse(chars);
        Console.WriteLine(new string(chars));
    }
}

Try solving on your own first, then reveal the official answer.

Explanation

Convert to char array, reverse, rebuild string. Alternative: StringBuilder from end to start.

Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details