Input: Key is the Element to be searched
Output: Index of Key in array or message of failure
------------------------------------------------------------
-----------------------------------------------------------
#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");
scanf("%d",&s);
for(i=0;i<=n;i++)
{
printf("The array number:\n");
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;
}
}
if(f==1)
{
printf("Search Not found!!!!!!!!\n\n");
}
return 0;
}
(By:Shahimtiyaj)
0 comments:
একটি মন্তব্য পোস্ট করুন