Linear Search Program in C++ With Source Code

#include<stdio.h>
#include<conio.h>

void main()
{
    int i,list[5]={7,5,3,8,6},count=0,size=5,num;
    clrscr();

    printf("Enter the element for search:");
    scanf("%d",&num);

    for(i=0;i<size;i++)
    {
        if(list[i]==num)
            count=1;
    }

    if(count==1)
        printf("search is successful");
    else
        printf("search is unsuccessful");
    getch();
}
Linear Search Program in C++ With Source Code Linear Search Program in C++ With Source Code Reviewed by Unknown on 5:43:00 PM Rating: 5

No comments:

Powered by Blogger.