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
Latest posts by Bikash Panda (see all)
- OSMC on Raspberry PI with Setup and Control using Android App - July 7, 2017
- DHT12 Interfacing with Raspberry Pi using Pi4J - June 19, 2017
- Send data using MQTT from Raspberry Pi with JAVA - June 12, 2017