Custom Search

date, segitiga pascal

<html>
<head><title>Segitiga Pascal - Created By Yohanes Surya</title>
<script language="Javascript">

/* DATE TANGGAL HARI JAM*/
function tanggal()
{
var tahun=new Date();
document.getElementById("tang").innerHTML=(tahun.getMonth()+" "+tahun.getDate()+" "+tahun.getHours()+":"+tahun.getMinutes()+":"+tahun.getSeconds());

setTimeout("tanggal()",1000);
}



/* CARA KE-1 SEGITIGA PASCAL
var ab= new Array();

var i,j;

for (i=0; i<=5;i++)
{
ab[i]=new Array();
for(j=1;j<=i;j++)
{
if(i==j || j==1)
{
ab[i][j]=1;
}
else
{
ab[i][j]=ab[i-1][j-1]+ab[i-1][j];
}
document.write(ab[i][j]);
}
document.write("<br/>");
}*/
/* CARA KE-2 SEGITIGA PASCAL
var x=new Array();
var line=prompt("Masukkan jumlah baris: ",10);

for(i=1;i<=line;i++)
{

x[i]=new Array();
for(j=1;j<=i;j++)
{
if(j==1 || j==i)
{
x[i][j]=1;
}
else
{
x[i][j]=x[i-1][j-1]+x[i-1][j];
}
}
}

document.write("<table>");
for(i=1;i<=line;i++)
{
document.write("<tr>");
for(j=1;j<=line-i;j++)
{
document.write("<td></td>");
}

for(j=1;j<=i;j++)
{
document.write("<td align=center>"+x[i][j]+"</td><td></td>");
}

for(j=1;j<=line-i;j++)
{
document.write("<td></td>");
}

document.write("</tr>");
}
document.write("</table>");
*/
</script>
</head>
<body onLoad="tanggal();">
<div id="tang" name="tang"></div>

</body>
</html>