#include<conio.h>
#include<stdio.h>
#define N 5
void main()
{
int a[N]={0};
int sp=-1,ch,n,i;
clrscr();
while(ch!=5)
{
printf("\n\t 1.PUSH.");
printf("\n\t 2.POP.");
printf("\n\t 3.DISPLAY.");
printf("\n\t 4.PEEP A PARTICULAR VALUE.");
printf("\n\t 5.EXIT ");
printf("\n\t ENTER UR CHOICE :::: ");
scanf("%d",&ch);
if(ch==1)
{
if(sp>=N)
{
printf("\n\t STACK FULL ");
break;
}
printf("\n\t ENTER DATA:::: ");
scanf("%d",&n);
sp++;
a[sp]=n;
}
if(ch==2)
{
printf("\n\t POPPED VALUE ::: %d",a[sp]);
a[sp]=0;
sp--;
}
if(ch==3)
{
for(i=sp;i>=0;i--)
{
printf("\n\t %d",a[i]);
}
}
}
getch();
}