the program is
#include<stdio.h>
#define MAX 10
int main()
{
int ab[MAX],i,n,search;
printf("enter the no of element");
scanf("%d",&n);
printf("enter the no");
for(i=0;i<n;i++)
{
scanf("%d",&ab[i]);
}
printf("enter the search element\n");
scanf("%d",&search);
for(i=0;i<n;i++)
{
if(search==ab[i])
{
printf("Elemnt is %d found at location %d\n",search,i+1);
break;
}
}
if(i==n)
printf("enter the element not found");
getch();
return 0;
}
the output is
#include<stdio.h>
#define MAX 10
int main()
{
int ab[MAX],i,n,search;
printf("enter the no of element");
scanf("%d",&n);
printf("enter the no");
for(i=0;i<n;i++)
{
scanf("%d",&ab[i]);
}
printf("enter the search element\n");
scanf("%d",&search);
for(i=0;i<n;i++)
{
if(search==ab[i])
{
printf("Elemnt is %d found at location %d\n",search,i+1);
break;
}
}
if(i==n)
printf("enter the element not found");
getch();
return 0;
}
the output is
No comments:
Post a Comment
Note: only a member of this blog may post a comment.