#include <stdio.h>
#define SIZE 5
int stack[SIZE];
int top=-1;
int isEmpty(){
    return(top ==-1);
}
int isFull(){
    return(top==SIZE -1)
}
void push(int ele)
{
    if(isFull)
    {
        printf("stack overflow%d\n",ele);
    }
    else
    {
        top++;
        stack[top]=ele;
        printf("push into stack%d\n",ele);
    }
}
void pop()
{
    if(isEmpty())
    {
        printf("stack Underflow\n");
    }
    else
    {
        printf("%d poped from stack\n",stack[top]);
        top--;
    }
}
void peek()
{
    if(isEmpty())
    {
        printf("stack is empty");
    }
    else
    {
        printf("top of the element%d\n",stack[top]);
    }
}
void display()
{
if(isEmpty())
{
    printf("stack is empty");
}
else
{
    printf("stack elements top to bottom\n");
    for(int i=top;i>=0;i--)
    {
        printf("%d\n",stack[i]);
    }
}
}
int main()
{
    push(10);
    push(20);
    push(30);
    display();
    peek();
    pop();
    display();
    push(40);
    push(50);
    push(60);
    display();
    peek();
    if(isEmpty())
    {
        printf("empty");
    }
    else
    {
        printf("have element");
    }
}