Write a program for searching of element from array

//this is a program to find the particular number from the entered elements of array
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],search,i,flag=0;

printf("\n\nAccepting the elements of array A: ");

for(i=0;i<10;i++)
{
printf("\n\nEnter the element of array: ");
scanf("%d",&a[i]);
}

printf("\n\nEnter the Number you want to search: ");
scanf("%d",&a[i]);

for(i=0;i<10;i++)
{
if(a[i]==search)
{
flag=1;
break;
}

}

if(flag==0)
printf("\n\nNumber Found");
else
printf("\n\nNumber not Found");


getch();

}


Previous
Next Post »