Answer Posted / 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 |
Post New Answer View All Answers
Are pointers really faster than arrays?
Why do some versions of toupper act strangely if given an upper-case letter?
How can I find the modification date and time of a file?
How can I find out if there are characters available for reading?
What is the use of static variable in c?
What are the __date__ and __time__ preprocessor commands?
Why is structure important for a child?
How can you convert integers to binary or hexadecimal?
What is scope and lifetime of a variable in c?
How many types of sorting are there in c?
Is c programming hard?
What is the use of clrscr?
Explain the difference between getch() and getche() in c?
How do I use strcmp?
What is the use of header files?