Search & Find out

Thursday, November 26, 2009

Delete element from stack ( deletion )

 Deleting an element  in stack of 9 elements

#include "stdio.h"
#include "conio.h"
void main ()
{
    int LA[10],i,j,n,m;
    clrscr ();
    printf("Enter the no. of elements in stack :  ");
    scanf("%d",&m);
    for (i=1;i<=m;i++)
    {
        printf ("\nEnter the number: ");
        scanf ("%d",&LA[i]);
    }
    printf ("\n\nEnter the location to be deleted: ");
    scanf ("%d",&n);
    n=n;
    for (j=n;j<=m;j++)
    {
        LA[j]=LA[j+1];
    }
    printf("\n\n After deleting, the elements in stack are \n");

    for (i=1;i
    {
        printf ("%d\n",LA[i]);
    }
getch ();
}



Download the executable (.exe)  file for this program..
download

0 comments:

Post a Comment

 

My Blog List

Term of Use