/**
* @(#)SegitigaPascal.java
*
*
* @author syafii jauhari
* @version 1.00 2009/7/27
*/
public class SegitigaPascal
{
private static void hitung ()
{
int sgtg[][] = new int[15][];
for (int r=0; r
sgtg[r] = new int[r+1];
sgtg[r][0] = 1;
sgtg[r][r] = 1;
for (int c=1; c
sgtg[r][c] = sgtg[r-1][c]+sgtg[r-1][c-1];
}
}
for (int r=0; r
for (int c=0; c
System.out.print(" "+sgtg[r][c]);
}
System.out.println("");
}
}
public static void main(String [] args)
{
hitung();
}
}
Kamis, 30 Juli 2009
Segitiga Pascal
Diposting oleh Jouhari di 9:18:00 AM
Label: Arsip java (newbi)
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar