linear search in a user given array using C

//Linear search:

Code:

#include<stdio.h>

int main()

{

int size,i,SE;

printf("Enter Array Size:");

scanf("%d",&size);

int arr[size];

printf("Enter Array Value:");

for(i=0;i<size;i++)

{

scanf("%d",&arr[i]);

}

printf("Enter Search value:");

scanf("%d",&SE);

for(i=0;i<size;i++)

{

if (arr[i] == SE)

{

printf("Found %d in the Location %d",SE,i);

break;

}

} //END LOOP

if(i== size)

{ printf("\nNOT FOUND");

}

return 0;

}

//Algorithm:

Step 1: start

Step 2: Create a user given array “arr[size]” this type

Step 3: Take a searching element value by user

Step 4: Create a for loop ,where, i from 0 to arr-1

if arr[i] equal to search element then return i , then go to (Step 5),

else

End if and break;

Step 5: End for loop

Step 6: if i equal to length of arr ,then return (NOT FOUND)

Step 7: End if

Step 8: Stop