#include <stdio.h>
#define MAX 5
int stack[MAX];
int top=-1;
void push(int value){
    if(top == MAX-1){
        printf("stack overflow cannot push%d\n",value);
    }
    else{
        top++;
        stack[top]=value;
        printf("%d pushed into stack\n",value);
    }
}
void pop(){
    if(top==-1){
        printf("stack underflow stck is emty\n");
    }
    else{
        printf("%d popped from stack\n", stack[top]);
        top--;
        }
        void display(){
            if(top ==-1){
                printf("stack is empty\n");
            }
            else{
                printf("stack element are:\n");
                for(int i =top;i>=0;i--){
                    printf("%d\n",stack[i]);
                }
            }
        }
        int main(){
            push(10);
            push(15);
            push(24);
            display();
        }