#include<stdio.h>
void main()
{
int a[100];
int i,n,num,flag=0;
printf("\n Enter the Limit : ");
scanf("%d",&n);
printf("\n Enter the %d Elements.......\n",n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("\nEnter the Number which you want to search : ");
scanf("%d",&num);
for(i=0;i<n;i++)
{
if(a[i]==num)
{
flag=1;
break;
}
}
if(flag==0)
printf("\n The searching Element %d is not found in the Array \n",num);
else
printf("\nThe Searching Element is in %d th position ",i+1);
}
No comments:
Post a Comment