0% found this document useful (0 votes)
10 views1 page

C Program for Array Search Function

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

C Program for Array Search Function

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Program

#include <stdio.h>

int main()
{
int i , a[4]={12,23,34,45};
int n;
printf("enter number to search ");
scanf("%d" , &n);

for(i=0; i<4 ; i++)


{
if (a[i] == n)
{
printf("number found at index %d \n" , i);
return 0;

}
}
printf("number not found \n");

return 0 ;
}

output
enter number to search 23
number found at index 1

You might also like