Programe for linear search in C


#include
#include
int main()
{
    char ch;
    int arr[40],n,i,item;
    printf("\nHow many elements you want to enter in the array: ");
    scanf("%d",&n);
    for(i=0;i    {
    printf("\nEnter element %d:" ,i+1);
    scanf("%d",&arr[i]);
}
do
{
       
        printf("\nEnter the element to be searched: ");
        scanf("%d",&item);
        for(i=0;i        {
                        if(item==arr[i])
                        {
                                        printf("\n%d found at position %d\n",item,i+1);
                                        break;
                                        }
                                        }
                                        if(i==n)
                                        printf("\n Item %d not found in array\n",item);
                                        printf("\n\nPress (Y/y )to continue: ");
                                        fflush(stdin);
                                        scanf("%c",&ch);
                                        }
                                        while(ch=='Y'||ch=='y');
                                        return 0;
                                        getch();
                                        }