QUOTE(sugunacode @ 4 Aug, 2008 - 12:39 AM)

writw a code for printing
1
0 1
1 0 1
0 1 0 1
In Pseudo-Code
int numberOfRows = 4; //You can change this number to adapt to the size of the triangle
int incrementalNumber = 0;
for (int i = 1; i = numberOfRows; i++) {
for (int j = 0; j < i; j++) { //iterates once the first row, twice the second row, and so on.
incrementalNumber++; //Increase this variable for every iteration
print((incrementalNumber % 2) + " "); //('% 2' = mod 2 = integer remainder after (multiple) division by 2 [0, 1]
//for example 9 % 4 = 1 since (integer division) 9/4 = (integer part) 2 with the remainder 1.
//Since the variable incrementalNumber will alter between odd and even, the remainder part will alter between 0 and 1, which is the number you print out on the screen.
} //print = (Java) System.out.print
println();
}
I think this is what you're asking for, although your image looks somewhat distorted. The code could however easily be modified to work with different distances between the numbers if needed.
If this is indeed schoolwork and you have difficulties then I recommend you brush up on your math, especially the algebra part.