Displaying all the Odd number between 1 - 99 in java using Nested For Loop -
Currently I'm only able to display the odd number of 1 3 5 7 9. However, I would like to show everyone how funny I am with 9 rows and 5 colors from 1-99 odd numbers that I know how to display 9 of the 3 3 7 7 rather than 9 lines.
I'm stuck with the code below.
public static zero principal (string algos []) {for (int i = 1; i & lt; = 9; i ++) {for (int j = 1; j & lt ; = 10; j ++) {if (j% 2! = 0) System.out.print (j + ""); } System.out.println (); }}
First you need to calculate your number,
(
But for this problem you can solve with a loop
for (int i = 1; i ; = 99 ; I ++) {if (number% 2! = 0) System.out.print (number + ""); If (number% 10 == 0) System.out.println (); }
Comments
Post a Comment