Give a one-line C expression to test whether a number is a
power of 2.
Answer Posted / lakshmi
void main()
{
int a;
scanf("%d",&a);
if((a&a-1)==0)
printf("Is a power of 2");
else
printf("Not a power of 2");
}
| Is This Answer Correct ? | 36 Yes | 8 No |
Post New Answer View All Answers
How to palindrom string in c language?
why nlogn is the lower limit of any sort algorithm?
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
Write a routine to implement the polymarker function
Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??
What is full form of PEPSI
could you please send the program code for multiplying sparse matrix in c????
how to test pierrot divisor
How can you relate the function with the structure? Explain with an appropriate example.
write a program for area of circumference of shapes
How do you verify if the two sentences/phrases input is an anagram using predefined functions in string.h and by using arrays?
write a simple calculator c program to perform addition, subtraction, mul and div.
What is the match merge ? compare data step match merge with proc sql merge - how many types are there ? data step vs proc sql
To Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates. String contains only lowercase characters ['a'-'z']
Design an implement of the inputs functions for event mode