<meta http-equiv="Content-Type"
content="text/html;charset=UTF-8"/>
<?php
echo "实心菱形";
echo
"<br/>";
for($q=1;$q<=5;$q++){
for($t=1;$t<=5-$q;$t++){
echo
" ";
}
for($k=1;$k<=2*$q-1;$k++){
echo
"*";
}
echo
"<br/>";
}
for($q=1;$q<=4;$q++){
for($t=1;$t<=$q;$t++){
echo
" ";
}
for($k=1;$k<=8-2*$q;$k++){
echo
"*";
}
echo "<br/>";
}
echo "空心菱形";
echo
"<br/>";
for($p=1;$p<=10;$p++){
if($p<=5){
for($b=1;$b<=5-$p;$b++){
echo " ";
}
for($c=1;$c<=2*$p-1;$c++){
if($c==1||$c==2*$p-1){
echo "*";
}else{
echo
" ";
}
}
echo
"<br/>";
}
else{
for($b=0;$b<=$p-6;$b++){
echo " ";
}
for($c=1;$c<=7-2*($b-1);$c++){
if($c==1||$c==7-2*($b-1)){
echo "*";
}else{
echo
" ";
}
}
echo
"<br/>";
$b++;
}
}
?>
for循环 打印菱形 空 和 实,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/ZH1132672711/p/3744081.html