Create an algorithm by following the steps and filling out t
Create an algorithm by following the steps and filling out the blanks below.When you are done write the corresponding code to implement the pattern.
Count up or down? Compare number lines in columns
Outer loop:
for (int i = _______; ________; _______){
// TODO: draw the current rows
}
Pattern O O o o o O O O O Pseudo-code: for each of the rows do the following: draw the right amount (n1) of draw the right amount (n2) of print a new lineSolution
public class Pattern {
public static void main(String[] args) {
for (int i = 0; i< 5; i++){
for(int j=1; j<=5-i; j++)
System.out.print(\"o \");
for(int k=1; k<=i; k++)
System.out.print(\". \");
System.out.println();
}
}
}
/*
Sample run:
o o o o o i n1(number of circle) n2(number of dots)
o o o o . 0 5 0
o o o . . 1 4 1
o o . . . 2 3 2
o . . . . 3 2 3
4 1 4
*/
