Re: [algogeeks] wrong output of C program

2012-06-07 Thread sengar.mahi
Good Question ,eagerly waiting for some good explanation to this one !!! On Fri, Jun 8, 2012 at 5:46 AM, Mad Coder imamadco...@gmail.com wrote: The following is a simple C program which tries to multiply an integer by 5 using the bitwise operations. But it doesn't do so. Explain the reason

Re: [algogeeks] wrong output of C program

2012-06-07 Thread Navin Kumar
one left shift is equivalent to multiplying with 2.Two left is equivalent to multiplying with 2^2. and so on. so i left shift means multiplying with 2^i. In your program you did left shift with 2.so it is equivalent to multiplying with 4. so when input is 1 function will return 4*1+1=5. when