#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],n,i,k,f=0;
clrscr();
printf("\n Enter how many number u want:-");
scanf("%d",&n);
printf("\n Enter %d numbers:-",n);
for(i=0;i<n;i++)
{
scanf(" %d",&a[i]);
}
printf("\n numbers are:-\n");
for(i=0;i<n;i++)
{
printf("\t%d",a[i]);
}
printf("\n Enter search key number:-");
scanf("%d",&k);
for(i=0;i<n;i++)
{
if(k==a[i])
{
printf("\n %d number is found on %d position.",k,i+1);
f=1;
break;
}
}
if(f==0)
{
printf("\n Number is not found");
}
getch();
}
/*
Enter how many number u want:-5
Enter 5 numbers:-4 6 8 9 14
numbers are:-
4 6 8 9 14
Enter search key number:-9
9 number is found on 4 position. */
#include<conio.h>
void main()
{
int a[10],n,i,k,f=0;
clrscr();
printf("\n Enter how many number u want:-");
scanf("%d",&n);
printf("\n Enter %d numbers:-",n);
for(i=0;i<n;i++)
{
scanf(" %d",&a[i]);
}
printf("\n numbers are:-\n");
for(i=0;i<n;i++)
{
printf("\t%d",a[i]);
}
printf("\n Enter search key number:-");
scanf("%d",&k);
for(i=0;i<n;i++)
{
if(k==a[i])
{
printf("\n %d number is found on %d position.",k,i+1);
f=1;
break;
}
}
if(f==0)
{
printf("\n Number is not found");
}
getch();
}
/*
Enter how many number u want:-5
Enter 5 numbers:-4 6 8 9 14
numbers are:-
4 6 8 9 14
Enter search key number:-9
9 number is found on 4 position. */