Write a C function to search a number in the given list of
numbers. donot use printf and scanf
Answers were Sorted based on User's Feedback
Answer / dinakarangct
the below function return the index value if present else
return a index which is equal to n;
int search(int n,int data,int *a)
{
int i;
for(i=0;i<n;i++)
if(a[i]==data)
return i;
}
Is This Answer Correct ? | 10 Yes | 4 No |
Answer / bharghavi
void search(int data)
{
for(int i=0;i<n;i++)
{
if(a[i]==data)
break;
}
}
Is This Answer Correct ? | 12 Yes | 10 No |
Answer / rohitakhilesh
void search(int *a,int data,int n)
{
for(int i=0;i<n;i++)
{
if(a[i]==data)
break;
}
}
Is This Answer Correct ? | 9 Yes | 7 No |
Answer / dhairyashil
void search(int data)
{
for(int i=0;i<n;i++)
{
if(a[i]==data)
break;
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / peter
Once the list of integer was sorted, u can use binary search.
Is This Answer Correct ? | 1 Yes | 6 No |
program to find the roots of a quadratic equation
14 Answers College School Exams Tests, Engineering, HP, IIIT, Infosys, Rajiv Gandhi University of Knowledge Technologies RGUKT, SSC,
main() { int c=- -2; printf("c=%d",c); }
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4
main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above
#ifdef something int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
void main() { int i=i++,j=j++,k=k++; printf(ā%d%d%dā,i,j,k); }
main() { int i=5; printf("%d",++i++); }
Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped
What is the output for the program given below typedef enum errorType{warning, error, exception,}error; main() { error g1; g1=1; printf("%d",g1); }
how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }