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
What is static and auto variables in c?
Which type of language is c?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
What is the Purpose of 'extern' keyword in a function declaration?
Differentiate between calloc and malloc.
What are valid operations on pointers?
what are enumerations in C
Did c have any year 2000 problems?
What is the explanation for cyclic nature of data types in c?
Explain the array representation of a binary tree in C.
Why c is called procedure oriented language?
Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What are lookup tables in c?
What is a node in c?