Give a fast way to multiply a number by 7
Answer Posted / anonymous
The easiest way is to relate the number to be multiplied
by, to a power of 2. Then a corresponding number of left
shifts to that power with an addition or subtraction would
give the desired result.
In this case, 7 can be written as 2^3 - 1 or 8 - 1.
Therefore, shift the number to the left thrice which would
multiply it by 8. Then subtract the original. You can also
do this as
4 + 2 + 1 = 2^2 + 2^1 + 1
| Is This Answer Correct ? | 20 Yes | 6 No |
Post New Answer View All Answers
writ a program to compare using strcmp VIVA and viva with its output.
Explain what are linked list?
Explain how do you print only part of a string?
Why & is used in c?
What is an auto variable in c?
using only #include
How can my program discover the complete pathname to the executable from which it was invoked?
What is the difference between array and pointer in c?
How do you search data in a data file using random access method?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
Why is struct padding needed?
write a programming in c to find the sum of all elements in an array through function.
What are the 4 data types?
what is the different bitween abap and abap-hr?
Which is the best website to learn c programming?