Determine if a number is a power of 2 at O(1).
Answers were Sorted based on User's Feedback
Answer / hary
int Isnopowerof2(int n)
{
if (n & n-1)
return 0;
return 1;
}
| Is This Answer Correct ? | 15 Yes | 0 No |
if((~n+1)& n ==n) printf("\n Given number is power of 2");
else printf("\Not the POwer of 2");
| Is This Answer Correct ? | 1 Yes | 0 No |
Define a structure to store roll no, name and marks of a student. Using the structure of above write a ‘C’ program to create a file “student.dat”. There must be one record for every student in the file. Accept the data from the user.
How do i store a paragraph into a string? for example, if i input a long paragraph, the program will read the words one by one and concatenate them until no word is left.
Input is "rama loves rajesh and rajesh Loves rama also and rajesh wear gloves and bloves" To print output is count the numbers of times repeted the word love without case sensitive.
what is the difference between i++ and ++i?
find the minimum of three values inputted by the user
actually i have 2 years teaching experience as computer faculty but now i am a DBA but when i go for interview many peoples asked me why i left my teaching profession and why i want to come in this field kindly give me the proper answer of this queston
How arrays can be passed to a user defined function
What math functions are available for integers? For floating point?
A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference
Explain the difference between getch() and getche() in c?
write a program to display the numbers in the following 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
Why c is a procedural language?