Quick actions

cmd+k|ctrl+k

Navigation

Languages

ReverseString

Snippet info

Language

Csharp

Visibility

public

Author

anna1.1

Created

2020-07-17T08:28:48Z

Updated

2020-07-17T08:28:48Z

using System;
 
class MainClass
{
    public static void Main(string[] args)
    {
        string myString = "Hello There!";
        
        Reverse(myString);
    }

    static void Reverse(string s)
    {
        string result = string.Empty; 
        
        for (int i = s.Length - 1; i >= 0; i--) // going through indexes from the back
        {
            result = result + s[i];
        }
    
        Console.WriteLine(result);
    }
}
INFO