#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,a[10],b;
cout<<"enter the size\n";
cin>>n;
cout<<"enter the elements\n";
for(int i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"enter the element you want to find";
cin>>b;
for(int j=0;j<n;j++)
{
if(a[j]==b)
{
cout<<j+1;
}
}
getch();
}
#include<conio.h>
void main()
{
clrscr();
int n,a[10],b;
cout<<"enter the size\n";
cin>>n;
cout<<"enter the elements\n";
for(int i=0;i<n;i++)
{
cin>>a[i];
}
cout<<"enter the element you want to find";
cin>>b;
for(int j=0;j<n;j++)
{
if(a[j]==b)
{
cout<<j+1;
}
}
getch();
}
No comments:
Post a Comment