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 / e v n raja

#include<stdio.h>
#include<conio.h>

void main()
{
int a[5],i,ele;


clrscr();

printf("enter the array elements
");

for (i=0; i<5; i++)
scanf("%d",&a[i]);

printf("Enter the element to be search
");
scanf("%d",&ele);

// searching for the element

for (i=0; i<5; i++)
{
if (a[i]==ele)
{
printf("Element found %d , position==%d",ele,i);
break;
}
}

} // end of main()

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is character set?

1116


Is multithreading possible in c?

949


What does c in a circle mean?

1018


In which header file is the null macro defined?

1301


What is the difference between procedural and functional programming?

1007


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

1047


Why is %d used in c?

958


What is #include stdio h and #include conio h?

1038


What is indirection?

1022


What is 2c dna?

1015


The file stdio.h, what does it contain?

1115


Explain what’s a signal? Explain what do I use signals for?

1052


Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record

5153


Is it cc or c in a letter?

957


write a program to display all prime numbers

1911