Program by -Jayant
#include<conio.h>
#include<stdio.h>
void main()
{
int arr[50],i,lim,find,flag=0,loc,value; //variable declaration
clrscr();
printf("Please enter the maximum number of elements of array you want to insert:->");
scanf("%d",&lim);
for(i=0;i<lim;i++) //loop for feeding values into the array
#include<stdio.h>
void main()
{
int arr[50],i,lim,find,flag=0,loc,value; //variable declaration
clrscr();
printf("Please enter the maximum number of elements of array you want to insert:->");
scanf("%d",&lim);
for(i=0;i<lim;i++) //loop for feeding values into the array
{
printf("\nPlease enter the element of the array now:->");
scanf("%d",&arr[i]);
}
printf("\nPlease enter that element you want to search into the array");
scanf("%d",&find);
for(i=0;i<lim;i++)
{
if(find==arr[i]) //base condition for checking availability
{
flag=5;
loc=i+1;
}
}
if(flag)
{
printf("\nthe value you intered is into this array");
printf("\nthe value of that item is %d and the location is %d",find,loc);
}else
{
printf("element not found");
}
getch();
}
printf("\nPlease enter the element of the array now:->");
scanf("%d",&arr[i]);
}
printf("\nPlease enter that element you want to search into the array");
scanf("%d",&find);
for(i=0;i<lim;i++)
{
if(find==arr[i]) //base condition for checking availability
{
flag=5;
loc=i+1;
}
}
if(flag)
{
printf("\nthe value you intered is into this array");
printf("\nthe value of that item is %d and the location is %d",find,loc);
}else
{
printf("element not found");
}
getch();
}
No comments:
Post a Comment
Please write your Views about this Post here:->;