C program to delete element of particular position in Array.


#include<stdio.h>
#include<conio.h>
int main()
{
    int a[50],pos,k,n;
    clrscr();
    printf("Enter size of Array:");
    scanf("%d",&n);
    printf("Enter %d elements in Array:\n",n);
    for(k=0; k<n; k++)
    {
        scanf("%d",&a[k]);
    }
    printf("Enter position of that element you want to delete:");
    scanf("%d",&pos);
    for(k=pos; k<n; k++)
    {
        a[k]=a[k+1];
    }
    printf("After deleting element at particular position,Array is:");
    for(k=0; k<n-1; k++)
    {
        printf("\n%d",a[k]);
    }
    return 0;
}

*** Input && Output ***



Post a Comment

0 Comments