Wednesday, 3 September 2014

#include<stdio.h>
#include<conio.h>
int main ()
{
    int i_list[100],i,n,x,p;
    printf("enter the size of list");
    scanf("%d",&n);
    printf("enter the element");
    for(i=0;i<n;i++)
    scanf("%d",&i_list[i]);
    p=0;
    printf("enter the elment to be searching:");
    scanf("%d",&x);
    for(i=0;i<n;i++)
    {
                    if(i_list[i]==x)
                    {
                                 p=i;
                    }
    }
                    if(p>0)
                    printf("%d index of number is %d is",x,p);
                    else
                    printf("try agian");
                    getch();
                    return 0;
 }            
                       
                            Out put
 Final submission:

No comments:

Post a Comment

Note: only a member of this blog may post a comment.