In interview, interviewer asked me to write program for reverse star pattern. it was just to check my logic. in this post I am sharing this program.
Inner loop prints line wise and outer loop prints column wise.
Output of the above code will be
Inner loop prints line wise and outer loop prints column wise.
<?php
for($i = 10; $i > 0 ; $i--){
for($j = 0; $j < $i ; $j++){
echo '*';
}
echo '<br/>';
}
?>
for($i = 10; $i > 0 ; $i--){
for($j = 0; $j < $i ; $j++){
echo '*';
}
echo '<br/>';
}
?>
Output of the above code will be
**********
*********
********
*******
******
*****
****
***
**
*
*********
********
*******
******
*****
****
***
**
*
No comments:
Post a Comment