Quick actions

cmd+k|ctrl+k

Navigation

Languages

Reverse a string using stack

Snippet info

Language

Csharp

Visibility

public

Author

dhaval-90

Created

2022-05-03T09:07:54.477328Z

Updated

2022-05-03T09:07:54.477328Z

using System;
using System.Collections.Generic;
using System.Linq;

class MainClass {
    static void Main() {
        Stack<char> chars = new Stack<char>();
foreach (char c in "LET'S REVERSE!")
{
chars.Push(c);
}
while (chars.Count > 0)
{
Console.Write(chars.Pop());
}
Console.WriteLine();
    }
}
INFO