#include<stdio.h>
#define MAX 100
void main()
{
int arr[MAX];
int i, n, ele, pos, flag=0;
printf("Enter size of array:\n");
scanf("%d",&n);
printf("Enter the elements of array:\n");
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
printf("Elements in array are:\n");
for(i=0;i<n;i++)
{
printf("%d ",arr[i]);
}
printf("\n\nEnter element to delete\n");
scanf("%d",&ele);
for(i=0;i<n;i++)
{
if(arr[i]==ele)
{
flag=1;
for(;i<n-1;i++)
{
arr[i]=arr[i+1];
}
}
}
if(flag==0)
{
printf("\nDeletion not possible as element to be deleted is not exist.\n");
}
else
{
printf("\nElements of array after deletion are:\n");
for(int i=0;i<n-1;i++)
{
printf("%d ",arr[i]);
}
}
}