Important Pattern Code For Interview Room
If you try the best Pattern code For Interview Room So today I will tell you 13+ Most Important Pattern Code For Interview Room | Pattern Code in PHP .I hope this Pattern Code is very usefull your Knowledge Point of view.
Pattern 1 :
<?php
for($i=1;$i<=5;$i++){
for($j=1;$j<=$i;$j++){
echo " $j ";
}
echo '</br>';
}
?>
Pattern 2 :
<?php
for($i=1;$i<=5;$i++){
for($j=1;$j<=$i;$j++){
echo " $i ";
}
echo '</br>';
}
?>
Pattern 3 :
<?php
for($i=5;$i>=1;$i--){
for($j=1;$j<=$i;$j++){
echo " $i ";
}
echo '</br>';
}
?>
Pattern 4 :
<?php
for($i=1;$i<=5;$i++){
for($j=1;$j<=$i;$j++){
echo " * ";
}
echo '</br>';
}
?>
Pattern 6 :
<?php
for($i=5;$i>=1;$i--){
for($j=1;$j<=$i;$j++){
echo " * ";
}
echo '</br>';
}
?>
Pattern 7 :
<?php$n=5;for($i=1;$i<=$n;$i++){for($j=1;$j<=(2*$n)-1;$j++){if($j>=$n-($i-1) && $j<=$n+($i-1)){echo "*";}else{echo "& nbsp;& nbsp;";//remove spave between & and nbsp}}echo '</br>';}?>
Pattern 8 :
<?php
$str="SATYAM";
$count=strlen($str);
for($i=0;$i<$count;$i++){
for($j=0;$j<=$i;$j++){
echo " $str[$j] ";
}
echo '</br>';
}
?>
Pattern 9 :
<?php$str="SATYAM";$count=strlen($str);for($i=6;$i>=0;$i--){for($j=0;$j<$i;$j++){echo " $str[$j] ";}echo '</br>';}?>
Pattern 10 :
<?php$n=5;for($i=1;$i<=$n;$i++){for($j=1;$j<=$n;$j++){if($i==1 || $i==$n){echo "*";}else{if($j==1 || $j==$n){echo "*";}else{echo "& nbsp;& nbsp;";//remove spave between & and nbsp}}}echo '</br>';}?>
Pattern 11 :
<?php
$n=5;
for($i=1;$i<=$n;$i++){
for($j=1;$j<=$n;$j++){
if($j==$i){
echo " * ";
}else{
echo "& nbsp;& nbsp;& nbsp;";
//remove spave between & and nbsp
}
}
echo '</br>';
}
?>
Pattern 12 :
<?php
$n=5;
for($i=1;$i<=$n;$i++){
for($j=1;$j<=$n;$j++){
if($j==$i || $i+$j==$n+1){
echo " * ";
}else{
echo "& nbsp;& nbsp;& nbsp;";
//remove spave between & and nbsp
}
}
echo '</br>';
}
?>
Pattern 13:
<?php
$n=4;
for($i=1;$i<=$n;$i++){
for($j=1;$j<=(2*$n)-1;$j++){
if($j>=$n-($i-1) && $j<=$n+($i-1)){
echo "*";
}else{
echo "& nbsp;& nbsp;";
//remove spave between & and nbsp
}
}
echo '</br>';
}
for($i=$n-1;$i>=1;$i--){
for($j=1;$j<=(2*$n)-1;$j++){
if($j>=$n-($i-1) && $j<=$n+($i-1)){
echo "*";
}else{
echo "& nbsp;& nbsp;";
//remove spave between & and nbsp
}
}
echo '</br>';
}
?>
Pattern Programming Code in Interview Room Download Code
0 Comments