There are nine empty spaces. Each one of them can be filled with either a 0, 1 or 2. The output should be something like:
000000000
000000001
000000002
000000010
000000011
000000012
000000020
000000021
000000022
000000100
000000101
000000102
000000110
000000111
000000112
000000120
000000121
000000122
000000200
000000201
000000202
000000210
Here is the code that I have used:
public class casesalgo { public static void main(String args[]) { for(int a=0;a<3;a++) { for(int b=0;b<3;b++) { for(int c=0;c<3;c++) { for(int d=0;d<3;d++) { for(int e=0;e<3;e++) { for(int f=0;f<3;f++) { for(int g=0;g<3;g++) { for(int h=0;h<3;h++) { for(int i=0;i<3;i++) { System.out.println(""+a+b+c+d+e+f+g+h+i); } } } } } } } } } } }
The problem is that I am getting some blank lines in the output which I do not want. Why are they appearing and how do I get rid of them?