answersLogoWhite

0

function pascal($depth){

$row = array(1);

while($depth > 0){

$newRow = array(1);

for($n = 1; $n < count($row); $n++){

$newRow[] = $row[$n - 1] + $row[$n];

}

$newRow[] = 1;

$depth --;

echo implode(' ', $newRow) . "\n";

$row = $newRow;

}

}

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

How do you write a c program to convert binary to decimal by using while statement?

write a c++ program to convert binary number to decimal number by using while statement


How do you write a sentence using was and were?

I was milking the cows while they were fishing!


How do you write an equation while using circumference?

Diameter = Circumference/pi


What is the difference between write and writeln in pascal?

'ln' -- it means 'new line' after writing


What are built in function?

Write in Pascal is an example: it doesn't come from a library, it is built-in into the compiler.


What are built-in functions?

Write in Pascal is an example: it doesn't come from a library, it is built-in into the compiler.


How do you write a program in pascal to find area of a trapezium using pascal?

To write a program in Pascal to find the area of a trapezium, you can follow this structure: program AreaOfTrapezium; var a, b, height, area: real; begin writeln('Enter the lengths of the two parallel sides (a and b) and the height:'); readln(a, b, height); area := 0.5 * (a + b) * height; writeln('The area of the trapezium is: ', area:0:2); end. This program prompts the user for the lengths of the parallel sides and the height, calculates the area using the formula ( \text{Area} = 0.5 \times (a + b) \times \text{height} ), and then outputs the result.


Can you write a sentence using stood?

I stood in the corner while I watched the fight.


Can you write a sentence using the word 'wet'?

I became wet while bathing


Write a program that will graph using for loop?

A = 5do{statement;A = A + 1;} while (A < 10)


How do you know if odd or even in turbo pascal program?

if n MOD 2 == 0 THEN Write ("Even");


What are the advantages of turbo pascal?

it would help you logically.. and would simply introduce to you what is programming.. and about coding.. as having knowledge about this turbo pascal.. it is like studying first the logic needed in coding... ^^. Well, this question implies two things. First, the programming language Pascal is good because it is simple and easy to learn, compared to other languages e.g. C or Java. The code written in Pascal is also easy to read. There is less bugs (mistakes) when we write programs in Pascal, again compared to C. Second, the Turbo Pascal (software package) is a good environment for us to conveniently write Pascal programs. There are shortcut keys to compile and run the program. There are tools for debugging (correcting mistakes) in our code, too.