Skip to content

Instantly share code, notes, and snippets.

@flymio
Created September 29, 2018 22:48
Show Gist options
  • Save flymio/91d4b4df957ca75d0f3cdc8beeae4abf to your computer and use it in GitHub Desktop.
Save flymio/91d4b4df957ca75d0f3cdc8beeae4abf to your computer and use it in GitHub Desktop.
Искал перловое 'STR' x SCALAR, но не помнил название функции, в итоге в солюшинах нашел str_repeat
<?php
// Complete the staircase function below.
function staircase($n) {
for($i=0;$i<=$n-1;$i++){
for($j=$n-$i-1;$j>0;$j--){
echo " ";
}
for($j=$n-1;$j>$n-$i-2;$j--){
echo "#";
}
echo "\n";
}
}
$stdin = fopen("php://stdin", "r");
fscanf($stdin, "%d\n", $n);
staircase($n);
fclose($stdin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment