#include<stdio.h>
#include<conio.h>
main()
{
int array[100],search,c,n;
printf("enter the no of elements in array\n");
scanf("%d",&n);
printf("enter %d integer \n",n);
for(c=0;c<n;c++)
{
scanf("%d",&array[c]);
}
printf("enter the no to search\n");
scanf("%d",&search);
for(c=0;c<n;c++)
{
if(array[c]==search)
{
printf("%d is present at location on %d,\n",search,c+1);
break;
}
}
if(c==n)
printf("%d is not present in array",search);
getch();
}
\\output\\
#include<conio.h>
main()
{
int array[100],search,c,n;
printf("enter the no of elements in array\n");
scanf("%d",&n);
printf("enter %d integer \n",n);
for(c=0;c<n;c++)
{
scanf("%d",&array[c]);
}
printf("enter the no to search\n");
scanf("%d",&search);
for(c=0;c<n;c++)
{
if(array[c]==search)
{
printf("%d is present at location on %d,\n",search,c+1);
break;
}
}
if(c==n)
printf("%d is not present in array",search);
getch();
}
\\output\\

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