Table of Contents
Hello, C# Program to Check Whether Element Exists in Stack or Not We are going to know the vibrancy of. There are many interesting facts in this article. Let’s move on to the articles

C# Program to Check Whether Element Exists in Stack or Not
using System;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
Stack S = new Stack(5);
S.Push(10);
S.Push(20);
S.Push(30);
S.Push(40);
if (S.Contains(30))
Console.WriteLine("Item found in stack");
else
Console.WriteLine("Item did not find in stack");
}
}
}
Item found in stack
Final Words
We hope that you and your doubts have been resolved through the article C# Program to Check Whether Element Exists in Stack or Not. And if you have any doubts let us know via the comment box. We cater to your doubts. And if you liked this article, we ask you to share it with your friends.