Posted by: Prakash_Ji September 18, 2006
Login in to Rate this Post:
0
?
I think ur code prints ( i havent run ur code)
1 * 2 + 1 = k
2 * 2 + 1 = k etc
If it is so then the error is clear, u never computer the value (k) you wanted to display.
replace ur lines with these
for ( int i = 1; i <= 10; i++ )
{ k= i*2+1;
System.out.printf( "%d * 2 + 1 = %d\n", i,k);
}
try this out and let us know.
You seem to be new to Java, if so do ur homework sathi.