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 would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
Why doesnt that code work?
How can I find the modification date and time of a file?
When should structures be passed by values or by references?
Why main function is special give two reasons?
Is c a great language, or what?
Write a program to print fibonacci series without using recursion?
When a c file is executed there are many files that are automatically opened what are they files?
Difference between MAC vs. IP Addressing
Can a pointer be volatile in c?
What does malloc () calloc () realloc () free () do?
What is the difference between far and near ?
What is a nested loop?
What is variable and explain rules to declare variable in c?
please give me some tips for the placement in the TCS.