52.write a “Hello World” program in “c” without using a
semicolon?
53.Give a method to count the number of ones in a 32 bit number?
54.write a program that print itself even if the source file
is deleted?
55.Given an unsigned integer, find if the number is power of 2?
Answer Posted / sivajyothi katireddi
55:
if(num & (num-1) == 0)
{
printf("num is power of 2\n");
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Explain the difference between the local variable and global variable in c?
Write a c program to demonstrate character and string constants?
Explain what will the preprocessor do for a program?
Explain how can I make sure that my program is the only one accessing a file?
What are keywords in c with examples?
What is sizeof array?
Which is best linux os?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What are Macros? What are its advantages and disadvantages?
What are control structures? What are the different types?
Explain what happens if you free a pointer twice?
What is difference between far and near pointers?
How can I write a function that takes a format string and a variable number of arguments?
What are global variables?
Explain what is operator promotion?