The following program takes a number as an input and checks whether that number is present in a group of elements or not. It takes linear time to execute. The program is implemented using c.
printf("Enter number of elements of the group : ");
printf("nEnter a element for searching : ");
printf("%d found in %d position.",m,i+1);
Description :In the above program the group of elements are stored using array. Then the input number is compared with all the elements in the array. If input number and element of array are equal, then it prints found and terminates.
Output:Enter number of elements : 59 6 7 2 8Enter a element for searching : 77 found in 3 position