// Driver code public static void Main(String[] args) { Stack s = new Stack(); s.push(1); s.push(2); s.push(3); Console.WriteLine("current size: " + s.size()); Console.WriteLine(s.top()); s.pop(); Console.WriteLine(s.top()); s.pop(); Console.WriteLine(s.top()); Console.WriteLine("current size: " + s.size()); /* * Output : * current size: 3 * 3 * 2 * 1 * current size: 1 */ }