begin
int a = 1;
int b = 1;
int i;
int j;
int iLevel;
print ("masukan level")
accept iLevel
if ( iLevel = 1 )
{ print "0"
}
else
{ print "0"
print (" ")
for ( a= 2 ; a < = iLevel ; a ++ )
{ c = a + b;
a = b;
b = c;
}
}
end if
end
Selasa, 15 Januari 2013
Senin, 14 Januari 2013
Algoritma Segitiga Pascal
Int i = 0;
Int j = 1;
Int k = 1;
Int iBil;
Begin
print("Masukkan Level: ");
for (i=0; i<=iBil; i++)
{
for (int j = 1; j <= iBil - i; j++)
print(" ");
{
for (k = 1; k <= i; k++)
{
if (k==0||i==k)
print(i + " ");
}
}
printnl();
}
End
Int j = 1;
Int k = 1;
Int iBil;
Begin
print("Masukkan Level: ");
for (i=0; i<=iBil; i++)
{
for (int j = 1; j <= iBil - i; j++)
print(" ");
{
for (k = 1; k <= i; k++)
{
if (k==0||i==k)
print(i + " ");
}
}
printnl();
}
End
Langganan:
Postingan (Atom)