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
Write a program for Overriding.
What is strcpy() function?
What is the process to create increment and decrement stamen in c?
difference between Low, Middle, High Level languages in c ?
Define and explain about ! Operator?
The statement, int(*x[]) () what does in indicate?
please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
Are comments included during the compilation stage and placed in the EXE file as well?
Which is better between malloc and calloc?
How to get string length of given string in c?
Explain that why C is procedural?
What are structure members?
What do you mean by a local block?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.