#include<stdio.h>
void main()
{
int a[10],i,n,m,c=0;
printf("\n enter the size of the array");
scanf("%d",&n);
printf("\n enter the elements of the array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\n enter the number to be searched");
scanf("%d",&m);
for(i=0;i<=n-1;i++)
{
if(a[i]==m)
{
printf("\n number %d found at position %dn",a[i],i);
c=1;
}
}
if(c==0)
{
printf("\n the number is not found");
}
}
void main()
{
int a[10],i,n,m,c=0;
printf("\n enter the size of the array");
scanf("%d",&n);
printf("\n enter the elements of the array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
printf("\n enter the number to be searched");
scanf("%d",&m);
for(i=0;i<=n-1;i++)
{
if(a[i]==m)
{
printf("\n number %d found at position %dn",a[i],i);
c=1;
}
}
if(c==0)
{
printf("\n the number is not found");
}
}
No comments:
Post a Comment