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 |
find A^B using Recursive function
main() { int i; printf("%d",scanf("%d",&i)); // value 10 is given as input here }
main(){ int a= 0;int b = 20;char x =1;char y =10; if(a,b,x,y) printf("hello"); }
/*what is the output for*/ void main() { int r; printf("Naveen"); r=printf(); getch(); }
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.
write a c-program to display the time using FOR loop
Give a one-line C expression to test whether a number is a power of 2.
How we print the table of 2 using for loop in c programing?
main() { char *p = “ayqm”; char c; c = ++*p++; printf(“%c”,c); }
int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.
2 Answers Bosch, eInfochips, HCL, IHCL,
main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }