#include
#include
void main()
{
int stack[10],top,i;
clrscr();
printf("Enter the value of the top:");
scanf("%d",&top);
printf("Enter data for stack:\n");
for(i=0;i=0;i--)
{
printf(" ");
printf("%2d\n\n",stack[i]);
}
printf("Add a number to the stack:");
scanf("%d",&stack[top]);
printf("After addition The stack is :\n");
for(i=top;i>=0;i--)
{
printf(" ");
printf("%2d\n\n",stack[i]);
}
getch();
}
0 comments:
Post a Comment