answersLogoWhite

0


Best Answer

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

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write pascal tringle in php using while loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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


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


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 is the difference between write and writeln in pascal?

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


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.


Write a program that will graph using for loop?

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


How do you write a c program to print n no's required using while loop?

int i=0; while (i++&lt;n) { /*...*/ }


Using while loop write a program which calculates the product of digits from 1 to 5 and also show these nos vertically?

Using while loop, write a program which calculates the product of digits from 1 to 5 and also show these no's vertically.


Can you write a sentence using erratic?

My wife's behaviour while pregnant has been very erratic.