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


Please Help Members By Posting Answers For Below Questions

Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

569


What are header files in c?

612


Explain how can you restore a redirected standard stream?

585


Compare interpreters and compilers.

633


Why cant I open a file by its explicit path?

593






What are the disadvantages of c language?

614


How can you determine the maximum value that a numeric variable can hold?

631


What are the different types of pointers used in c language?

609


What is sizeof array?

604


provide an example of the Group by clause, when would you use this clause

1701


Multiply an Integer Number by 2 Without Using Multiplication Operator

314


When we use void main and int main?

584


What is methods in c?

635


What is the time and space complexities of merge sort and when is it preferred over quick sort?

671


What does typeof return in c?

633