Amazon Interview Question
Software Engineer / Developers<pre lang="" line="1" title="CodeMonkey20397" class="run-this">class Main
{
public static void printOddPowers3(int n)
{
if(n<1) throw new IllegalArgumentException();
int oddPow = 3;
if (n>=1) System.out.println("1: " + oddPow);
for(int i=2; i<=n; ++i)
{
oddPow = oddPow * 9;
System.out.println( (2*i -1) + ": " + oddPow);
}
}
}
</pre>
- Vivek April 30, 2011