PHP output erect pyramid

巴扎黑
Release: 2016-11-22 16:05:45
Original
1450 people have browsed it

$a = 10;
function zjt($a) {
            global $a;
                                                     ​$ i ++) // The number of rows that control output {
for ($ j = 1; $ j & lt; = $ a -$ i; $ j ++) // Control the number of spaces of each line {
echo "& nbsp";;
                                                                                                                                                                                                                        
                           echo "* ";                                                                 echo " }
                                                                                               20;
function dzjt($a)                                                                                                                                                                                             ​a;
                                                                                                                          // Control the number of spaces in each line of output
* Number

                                                                                                                                            ";}} H echo" & lt; br & gt; ";
}}
dzjt ($ a);*/// call the djzt () function





echo '1 ~ 100 prime:';
for($i = 2;$i <= 100;$i++)
                                                                                                                                                                                                     ($j = 2;$j < $i;$j++)
                                                                                                             //$a=0, can be divided by other numbers
                                                                                                        echo $i." " ;
}
}






echo '1 Sum of prime numbers ~100: '

$sum = 0;
for($i = 2;$i <= 100;$i++)
{
$a = 1;
for($j = 2;$ j < $i;$j++)
                                                                                                                     break; $sum = $sum + $i;
                                                                                                                                                        $sum

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template