#include<stdio.h>
#include<conio.h>
#define MAX 50
void main()
clrscr();
printf("enter the size of array..");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter element:%d",i+1);
scanf("%d",&a[i]);
}
printf("enter the element to be searched..");
scanf("%d",&no);
for(i=0;i<n;i++)
{
if(no==a[i])
{
printf("number found at location :%d",i+1);
break;
}
else
{
printf("\n not found.");
}
}
getch();
}
#include<conio.h>
#define MAX 50
void main()
{
int a[MAX],n,i,no;clrscr();
printf("enter the size of array..");
scanf("%d",&n);
for(i=0;i<n;i++)
{
printf("\n enter element:%d",i+1);
scanf("%d",&a[i]);
}
printf("enter the element to be searched..");
scanf("%d",&no);
for(i=0;i<n;i++)
{
if(no==a[i])
{
printf("number found at location :%d",i+1);
break;
}
else
{
printf("\n not found.");
}
}
getch();
}
No comments:
Post a Comment