c program
linear search program* // Take an array as input from the user. Search for a given number x and print the index at where x is present in the array. #include <stdio.h> int main(void) { int n,x; printf("Enter the positive size of the array: "); scanf("%d",&n); int arr[n]; printf("Enter the element of array: "); for(int i=0; i<n; i++){ scanf("%d", &arr[i]); } printf("Enter which number you want to search: "); scanf("%d",&x); int found = 0; for(int i = 0; i<n; i++){ if(arr[i]==x){ printf("The index is %d and the the number is %d",i, x); found = 1; break; } if(!found) { printf("The index is not present"); } } return 0; }