Finding a number which was log of base 2
Answer / jaganathan gnanavelu
log of base 2 means given variable is power of 2. So
void main(){
int x;
if(x&(x-1){
printf("Given Number is not log base 2\n");
}
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Write a program that produces these three columns sequence nos. using loop statement Sequence nos. Squared Squared + 5 1 1 6 2 4 9 3 9 14 4 16 21 5 25 30
Finding a number multiplication of 8 with out using arithmetic operator
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.
Program to find the largest sum of contiguous integers in the array. O(n)
how to delete an element in an array
void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }
Find the largest number in a binary tree
main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }
How to swap two variables, without using third variable ?
104 Answers AB, ADP, BirlaSoft, Cisco, Cygnet Infotech, HCL, Hewitt, Honeywell, HP, IBM, Infosys, Manhattan, Microsoft, Mobius, Percept, Satyam, SofTMware, TCS, Wipro, Yamaha,
Write a C program that defines a 2-dimentional integer array called A [50][50]. Then the elements of this array should randomly be initialized either to 1 or 0. The program should then print out all the elements in the diagonal (i.e. a[0][0], a[1][1],a[2][2], a[3][3], ……..a[49][49]). Finally, print out how many zeros and ones in the diagonal.
source code for delete data in array for c
main() { extern out; printf("%d", out); } int out=100;