Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to search for an element in a given array.
If the array was found then display its position otherwise
display appropriate message in c language

Answer Posted / vs

#include<stdio.h>
#include<conio.h>
void main()
int a[5],i;
int e,t=0,p=0;
clrscr();
printf("enter the array of elements/n");
for(i=0;i<5;i++)
scanf("%d",&a[i]);
clrscr();
printf("enter the element to search/n");
scanf("%d",&e);
for(i=0;i<5;i++)
{
if(a[i]==e)
{
t=1;
p=i;
}
}
if(t==1)
printf("element found--%d/n position--%d",e,p);
else
printf("element not found/n");
getch();
}

Is This Answer Correct ?    21 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can I change the size of the dynamically allocated array?

1152


what is a constant pointer in C

1184


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

1441


How are structure passing and returning implemented?

1043


Explain do array subscripts always start with zero?

1241


What is #include called?

1065


What are different types of pointers?

1076


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

3584


What is a memory leak? How to avoid it?

1351


Is it better to bitshift a value than to multiply by 2?

1094


What is difference between stdio h and conio h?

1384


What is the collection of communication lines and routers called?

1129


What are comments and how do you insert it in a C program?

1254


Why does this code crash?

1104


What is #line used for?

1029