Program
#include <stdio.h>
int main()
{
printf("**************************************************************");
printf("\n**************************************************************");
printf("\n** WAP for Deletion from an array **");
printf("\n** Created by Sheetal Garg **");
printf("\n** Assistant Professor **");
printf("\n** Phone No:9467863365 **");
printf("\n**************************************************************");
printf("\n**************************************************************\n");
int n,i,a[5],pos;
printf("Enter no. of elements in the array\n");
scanf("%d",&n);
printf("enter array elements");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\nThe array elements before deletion are\n");
for(i=0; i<n; i++)
printf("%d\n",a[i]);
printf("enter the position of number to delete");
scanf("%d", &pos);
for(i=pos;i<n;i++)
a[i-1]=a[i];
printf("\nThe array elements after deletion are\n");
for(i=0; i<n-1; i++)
printf("%d\n",a[i]);
return 0;
}
Output
************************************************************** ************************************************************** ** WAP for Deletion from an array ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ************************************************************** ************************************************************** Enter no. of elements in the array 5 enter array elements 11 23 34 32 21 The array elements before deletion are 11 23 34 32 21 enter the position of number to delete 2 The array elements after deletion are 11 34 32 21