How to Perform Linear Search in Turbo C

  • How to Perform Linear Search in Turbo C


  • 1 Comment sorted by


  • #include
    #include
    main()
    {
    int data[10]={10,5,4,19,48,2,34,52};
    int x,n=8,loc,item;
    clrscr();
    for(x=0;x {
    printf("%d,",data[x]);
    }
    printf("\n Enter item to search:");
    scanf("%d",&item);
    x=0;
    while(x {
    x++;
    }
    if(data[x]==item)
    {
    printf("\nItem found and location is %d",x);
    }
    else
    {
    printf("\nItem not found");
    }
    getch();
    }


Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Popular Posts of the Week

    Optimum Creative