#include
#include
main()
{
int a[10],i,n,p,s;
clrscr();
printf("Input array size ");
scanf("%d",&n);
printf("\nInput %d elements ",n);
for(i=0;iscanf("%d",&a[i]);
printf("\nInput an element to be searched ");
scanf("%d",&s);
for(i=0;i{
if(a[i]==s)
{
printf("\nFirst occurence of %d is at position %d",s,i+1);
break;
}
if(i==n)
printf("\n%d not found is array",s);
}
}
No comments:
Post a Comment