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
What is character set?
Is multithreading possible in c?
What does c in a circle mean?
In which header file is the null macro defined?
What is the difference between procedural and functional programming?
Explain what is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Why is %d used in c?
What is #include stdio h and #include conio h?
What is indirection?
What is 2c dna?
The file stdio.h, what does it contain?
Explain what’s a signal? Explain what do I use signals for?
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
Is it cc or c in a letter?
write a program to display all prime numbers