We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
In every Iteration you should add previous result so that you would get result
....................................
1st Iteration:
result=a+2^0*b
.........................
2nd Iteration:
result = result + (2^1)*b
.........................
3rd Iteration:
result =result + (2^2)*b
........................
N^th Iteration:
result = result+ (2^n-1)*b
...........I hope It will help you!!!!!!!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Loops II
You are viewing a single comment's thread. Return to all comments →
a+2^0*b+2^1*b+2^2*b+2^3*b+........+2^n-1*b
In every Iteration you should add previous result so that you would get result .................................... 1st Iteration: result=a+2^0*b ......................... 2nd Iteration: result = result + (2^1)*b ......................... 3rd Iteration: result =result + (2^2)*b ........................ N^th Iteration: result = result+ (2^n-1)*b ...........I hope It will help you!!!!!!!