Input: Key the element to be deleted
Output:Array without key
----------------------------------------
----------------------------------------
//Delate an element from array data
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a[100],n,i,f=1,s;
printf("Enter the upper value:\n");
scanf("%d",&n);
printf("Enter the Searching value which you want: \n\n\n");
scanf("%d",&s);
printf(" Input The array number:\n");
for(i=0;i<=n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<=n;i++)
{
if(a[i]==s)
{
printf("%d is Found! in this Array .\n\n\n",s);
printf("The Array location is:%d\n\n",i);
f=0;
break;
}
}
if(i>n){
printf("\n Element not found!!!!!!!");
}
else
{
while(i<n)
{
a[i]=a[i+1];
i++;
}
printf("\n--After deletion new array list--\n\n");
for(i=0;i<n;i++){
printf("\t%d\n",a[i]);
}
}
getch();
return 0;
}
(By:shahimtiyaj)
0 comments:
একটি মন্তব্য পোস্ট করুন