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.

i mean first you have to calculate the first term then see that the first term is common in all terms so you have to just appy a loop after that , and in that loop i have told that what we have to perform. Now just simply iterate that loop and multilpy that first term to the matter that you calculated inside the loop.

## Java Loops II

You are viewing a single comment's thread. Return to all comments →

Will you tell me the Code how it solved.

for (int j = 0; j < n; j++) { a += b; System.out.print(a + " "); b *= 2; } System.out.println();

Thanks for sharing, found it very simple to understand.

Not sure why it's been down voted. It's a brilliant solution. Helped me a lot to understand what's going on. Thanks mate

Out of all the complicated solutions, you gave the simplest solution ever. Brilliant thinking! Thanks for sharing.

I am glad my comment helped you ! Keep Coding :D

really you make it very simple...too good

i didnt understand your logic can u explain it please

i mean first you have to calculate the first term then see that the first term is common in all terms so you have to just appy a loop after that , and in that loop i have told that what we have to perform. Now just simply iterate that loop and multilpy that first term to the matter that you calculated inside the loop.

Just brilliant!!!

LOL! I've made a "local" class similar to pow... XD (And completed the test) But... omg your answer were soo simple and efficient...

This is the best. I was using Math.pow unnecessarily.

good logic but it's is not working giving some runtime exception .