Sample Input: The new item to be popped into the array.
array data: 1,2,3,4,5,6
Sample output: A stack newly popped
output:5,4,3,2,1
--------------------------------------------------
--------------------------------------------------
//LIFO=Last In First Out
-------------------------------------------
------------------------------------------
#include<stdio.h>
int main()
{
int a[9],n=10,i,e,l,t;
printf("\nEnter top no: of elements :");
scanf("%d", &t);
printf("\nEnter the array data :\n");
for(i=0;i<=t;i++)
{
scanf("%d", &a[i]);
}
if(t<0)
{
printf("Stack is Empty");
}
else
{
e=a[t];
t=t-1;
for(i=t;i>=0;i--)
{
printf(" After popped new stack is:%d\n", a[i]);
}
}
return 0;
}
0 comments:
একটি মন্তব্য পোস্ট করুন