#include <stdio.h>
#include <stdlib.h>
int main() {
    int value,choice;
    while(1)
    {
        printf("1. Push \t 2. POP\t 3. Display\t 4. Exit\n");
        printf("Enter your choice");
        scanf("%d",&choice);
        switch (choice);
        {
            case 1:
                printf("Enter the value to be inserted\n");
                scanf ("%D",&value);
                push(value);
                break;
            case 2:
                 pop();
                 break;
            case 3:
                display();
                break;
            case 4:
                exit(0);
            default:
                printf("Wrong selection try agian\n");
    }
        
}
void push(int value)
{
    if(top==size-1
    {
        printf("stack overflow .......... insertion is not possible ");
    }
    else
    {
        top++;
        stack[top]=value;
        printf)"insertion successful\n");
    }
}
void pop()
{
    if(top==-1)
    {
        printf("stack is underflow !deletion is not possible\n");
    }
    else
    {
        printf("deleted line %d\n",stack[top]);
        top--;
    }
}
void display()
{
    if(top==-1)
    {
        printf("Stack is underflow\n");
    }
    else
    {
        int i;
        printf("Stack elements are\n");
        for (i=0;i<=top;i++)
        {
            printf("%d\n",stack[i]);
        }
        
        
        }
    }
    }
}
    }
    }
}
    }
    
})
}
    
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: