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 / laxmi
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5]={1,2,3,4,5};
int i;
clrscr();
printf("
enter the value");
scanf("%d",&i);
for(i=0;i<5;i++)
if(i<5)
{
printf("
the value is present=%d");
}
else
{
printf("
the value is absent=%d");
}
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is pass by reference in c?
Write a simple code fragment that will check if a number is positive or negative.
How can I open files mentioned on the command line, and parse option flags?
Are pointers really faster than arrays?
Write a program that accept anumber in words
What is the difference between a function and a method in c?
What are pointers really good for, anyway?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What is the difference between printf and scanf )?
What is a wrapper function in c?
What are the advantages of the functions?
Explain what will the preprocessor do for a program?
What are the disadvantages of c language?
What is variable initialization and why is it important?
How can you call a function, given its name as a string?