Find if a number is power of two or not?
Answer / om
int f(int num)
{
if(( num>0) && (!(num & (num-1))) )
return 1;
else
return 0;
}
// f(16)...... 16 & 15 = 10000 & 01111 =00000
f(4) ...... 4 & 3 =0100 & 0111 =0000
f(11).......11 & 10 = 1011 & 1010 = 1010 so not...
f(12).......12 & 11 = 1100 & 1011 = 1000 so not...
| Is This Answer Correct ? | 6 Yes | 0 No |
differentiate built-in functions and user – defined functions.
What are the primitive data types in c?
What is the difference between abs() and fabs() functions?
hello friends what do u mean by BUS ERROR i got this error while i am doing my program in DATA STRUCTURES
What are derived data types in c?
how to write a cprogram yo get output in the form * *** ***** ******* ********* ******* ***** *** *
Program to trim a given character from a string.
what is ur strangth & weekness
0 Answers Cognizant, LG Soft, NetEnrich,
Explain what is meant by high-order and low-order bytes?
code for bubble sort?
Difference between linking and loading?
how to make a scientific calculater ?