July 27, 2004 | GPL Compliance for Software Developers | The library |
package org.novalis.example;
public class Triangle { public static void triangle (int n) {
int rows = 1 << n; int i, j;
for (i = 0; i < rows; i ++) { for (j = 0; j < i; j ++) System.out.println (" "); for (j = 0; j < rows; j ++) { if ((i & j) != 0) System.out.println (" "); else System.out.println ("**"); } System.out.println ("\n"); } } }
Next: The driver Previous Top |
![]() |
Copyright © 2004, Free Software Foundation. Verbatim copying permitted provided this notice is preserved. |