亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP outputs the entire pyramid exercise
大家講道理
大家講道理 2017-05-16 13:01:08
0
3
712
<?php
$n = 10;
for($i = 1; $i <= $n; $i ++) {
    for($k = 1; $k <= $n - $i; $k ++) {
        echo " ";
    }
    for($j = 1; $j <= ($i - 1) * 2 + 1; $j ++) {
        echo '*';
    }
    echo '<br />';
}
?>

Please tell me why the following effect is displayed:

I have checked many times and cannot find the reason. Please give me some advice. Thank you!

大家講道理
大家講道理

光陰似箭催人老,日月如移越少年。

reply all(3)
滿天的星座

Mine is the whole thing. What did you test it on?

Peter_Zhu

The logic of your code is correct, but the use of ? in the display takes up two ** characters, so it does not look like a pyramid. This may be related to the software problem you are debugging.

為情所困

After inserting the codeecho "&nbsp;"; 改寫成 echo "&ensp;";, test it in each browser to display the entire pyramid.
Thank you teachers for your guidance, thank you very much!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template