#include <stdio.h>
#define MAX 5
int stack[MAX];
int top=-1;

void pop(int value){
    if(top==-1){
         printf("stack underflow stack is empty \n");
    }
    else{
      printf("%d popped from stack \n",stack[top]);
      top--;
      
    }
}
void display(){
    if(top==-1){
         printf("stack is empty \n");
    }
    else{
      printf("stack elements are:\n");
      for(int i=top;i>=0;i--){
          printf("%d\n",stack[i]);
      }
    }
}
int main(){
    pop();
     pop();
      pop();
      pop();
      display();
      return 0;
}