Hey guys,
I'm still a beginner in php and need some help from you with my coding. I need to calculate how many layers i can make with the available blocks.
see example below. For example, if i have 6 blocks, the pyramide will be 3 layers high, with 10 blocks 4 layers high ect.
Thank you in advance.
<?php
$blocks = readline("enter how many blocks are available for a pyramid?") . PHP_EOL;
$h = 1;
while ($h <= $blocks) {
$layers = $h++;
}
echo $layers;
?>
Is there any solution for this?
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.