How to push an element to a stack in C#

1 Answer

0 votes
using System;
using System.Collections;
  
class Program
{
    static void Main() {
        Stack st = new Stack();
         
        st.Push("c#");
        st.Push("c");        
        st.Push("c++");
        st.Push("vb.net");
        st.Push("java");
        st.Push("python");
 
        Console.WriteLine(string.Join(" ", st.ToArray()));
    }
}
 
  
  
/*
run:
  
python java vb.net c++ c c#
  
*/

 



answered Aug 4, 2022 by avibootz
...