#include<stdio.h>
#include<process.h>
#include<stdlib.h>
#define MAX 5
int top=-1,stack[MAX];
void push();
void display();
int main()
{
    int ch;
    while(1)
    {
    printf("your stack menu is \n");
    printf("1.push\n2.display\n3.exit\n");
    printf("enter your choice\n");
    scanf("%d",&ch);
    switch(ch)
    {
        case 1:push();
        break;
        case 2:display();
        break;
        case 3:
            exit(1);
        break;
        default:printf("invalid choice\n");
    }
    }
}
void push()
{
    int val;
    if(top==MAX-1)
        printf("your stack is full\n");
    else
    {
        printf("enter your element you want to push\n");
        scanf("%d",&val);
        top=top+1;
        stack[top]=val;
    }
}
void display()
{
    if(top==-1)
        printf("no element in your stack\n");
    else
    {
        int i;
         printf("Your stack is .....\n");
        for(i=top;i>=0;--i)
        {

            printf("%d\n",stack[i]);
        }
    }
}