Give a fast way to multiply a number by 7
Answer Posted / pratik chopra
It is very obvious above condition will not work if output
after multiplying by 7 is not 8 bit. In that case, if you
consider 64*7=448 which is 111000000 and a 9bit number.
Thus, there is an overflow. Even a normal decimal
calculation, restricted to 8 bit will not give a right answer.
In other words, any n-bit number whose multiplication with 7
is an n-bit number, the above solution will work otherwise,
overflow will occur.
For 8 bit no. max x<=(255/7)<=36.
Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?
What are header files in c?
Explain how can you restore a redirected standard stream?
Compare interpreters and compilers.
Why cant I open a file by its explicit path?
What are the disadvantages of c language?
How can you determine the maximum value that a numeric variable can hold?
What are the different types of pointers used in c language?
What is sizeof array?
provide an example of the Group by clause, when would you use this clause
Multiply an Integer Number by 2 Without Using Multiplication Operator
When we use void main and int main?
What is methods in c?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What does typeof return in c?