#include<stdio.h>
#include<conio.h>
int main()
{
int list[100],i,n,x,p;
printf("Enter the size of list-");
scanf("%d",&n);
printf("Enter the element-\n");
for(i=0;i<n;i++)
scanf("%d",&list[i]);
p=0;
printf("enter the element to be search-");
scanf("%d",&x);
for(i=0;i<n;i++)
{
if(list[i]==x)
p=i;
}
if(p>=0)
printf("index of element %d is= %d",x,p);
else
printf("Try again");
return 0;
getch();
}
==========@@@@=============@@@@=============@@@@@=========
Output
Something is missing in output due to system problem. if your system is working well fix my problem.
Missing line - Index of element 78 is= 4
Missing line - Index of element 78 is= 4

No comments:
Post a Comment
Note: only a member of this blog may post a comment.