#include<stdio.h>
#include<conio.h>
void main()
{
int arr[10],i,j,src,index,flag=0;
clrscr();
printf("Enter any 10 Elements in the ARRAY : ");
for(i=0;i<10;++i)
{
scanf("%d",&arr[i]);
}
printf("\nEnter The Element to be searched : ");
scanf("%d",&src);
for(j=0;j<10;++j)
{
if(arr[j]==src)
{
index=j;
flag=1;
break;
}
}
if(flag==0)
printf("Element Not Found !!!");
else
printf("Element Found At %d Index",index);
getch();
}
#include<conio.h>
void main()
{
int arr[10],i,j,src,index,flag=0;
clrscr();
printf("Enter any 10 Elements in the ARRAY : ");
for(i=0;i<10;++i)
{
scanf("%d",&arr[i]);
}
printf("\nEnter The Element to be searched : ");
scanf("%d",&src);
for(j=0;j<10;++j)
{
if(arr[j]==src)
{
index=j;
flag=1;
break;
}
}
if(flag==0)
printf("Element Not Found !!!");
else
printf("Element Found At %d Index",index);
getch();
}
0 comments:
Post a Comment