C programming

Sunday, January 18, 2009

#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:

Visitors

PlugIn.ws - Free Hit Counter, Web Site Statistics, Traffic Analysis

  © Blogger template Leaving by Ourblogtemplates.com 2008

Back to TOP