Easy csharp

Stack — LIFO demo #29

Problem

Push 1,2 then Pop and print.

Hints
  • Push / Pop

Your practice code

Ready — edit the code above and click Run.

Solution

using System;

class Program
{
    static void Main()
    {
        using System.Collections.Generic;
        var st = new Stack<int>();
        st.Push(1); st.Push(2);
        Console.WriteLine(st.Pop());
    }
}

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

Explanation

Stack is Last-In-First-Out—used for bracket matching.

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