Search This Blog

Sunday, November 7, 2010

A C alanguage program to sort array using sequential sort
 
#include
#include
void main(void)
{
clrscr();
int h=-1,sk;
int a[]={18,21,56,89,98,65};
printf("\n\nEnter your search key >> ");scanf("%d",&sk);

for(int i=0;i<6;i++)
{
if(a[i]==sk){h=i;}
}
clrscr();
if(h==-1){printf("\n\nSorry your search couldnt be found");}
else {printf("\n\nResult:-\n\nYour search key is at index no. %d ",h);}
getche();
}