#include <stdio.
h>
#include <conio.h>
int main()
{
int top = -1, val, stack[5], ch = 1, n, i;
printf("enter the size of stack");
scanf("%d", &n);
printf("choice\n1.push\n2.pop\n3.display\n4.exit");
while (ch)
{
printf("\nenter the choice");
scanf("%d", &ch);
switch (ch)
{
case 1:
if (top == n - 1)
{
printf("stack is overflow");
}
else
{
printf("enter the values in stack");
scanf("%d", &val);
top = top + 1;
stack[top] = val;
}
break;
case 2:
if (top == -1)
{
printf("stack is underflow");
}
else
{
printf("delete the value:%d", val);
val = stack[top];
top = top - 1;
}
break;
case 3:
printf("display stack");
for (i = 0; i <= top; i++)
{
printf("%d", stack[i]);
}
break;
case 4:
ch = 4;
printf("exit");
}
if (ch == 4)
break;
}
return 0;
}