
Searching and Sorting 569
printf("\nThe number of iterations are: %d",j);
}
else printf("\n Number Is not found ■);
getchO ;
}
OUTPUT:
Enter the array elements: 12 5 8 7
Enter the number from the list for searching: 5
The position of element 5 is: 3
The number of iterations are: 3
Explanation In the above program an array of five elements is declared. Numbers are entered
and stored in the array. The number whose position is to be located is entered from the keyboard.
The entire array is scanned and the given number is checked with all the elements one by one.
When the element is found, the
break statement terminates the loop. The number of