Jump to content

Nudiowi

New Members
  • Posts

    1
  • Joined

  • Last visited

Nudiowi's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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?
×
×
  • Create New...

Important Information

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.