Tutorials, Free Online Tutorials,It Challengers provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, core java, sql, php, c language etc. for beginners and professionals.

Breaking

Write a c Program to Search an Array Elements

Program to Search an Array Elements 

int i,a[50],num,size;
clrscr();
printf("Enter size of array: ");
scanf("%d",&size);
printf("Enter any %d element in array: \n",size);
for(i=0; i<size; i++)
{
scanf("%d",&a[i]);
}
printf("Enter number for find their position: ");
scanf("%d",&num);
for(i=0; i<size; i++)
{
if(a[i]==num)
{
printf("\n index of %d is  %d",num,i);
}
}
getch();
}

Output:-

No comments:

Post a Comment