Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to print
[123]
[456]
[789]
note : braces also need to be printed

Answer Posted / sumit manchanda

<?php
$count=0;
echo "[";
for($i=1;$i<10;$i++){

if($i%3==0){
echo "$i";
echo "]";
echo "</br>";
$count++;
}else{
if($count==3){
echo "[";
$count=0;
}
$count=$count+1;
echo "$i";

}
}

?>

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is session expiry?

897


What is get method in java?

995


How to convert strings to numbers in php?

1054


Which is useful for method overloading?

1081


Which methods should be used for sending an email using the variables $to, $subject, and $body?

1042


What is difference between print and echo in php?

871


Tell me are parent constructors called implicitly inside a class constructor?

895


How do I escape data before storing it into the database?

912


Can you convert php to html?

922


For image work which library is used in php?

946


In php, how to redirect from one page to another page?

883


Declare a new variable in php equal to the number 3;

883


What is encapsulation in php?

937


Which function Returns the time of sunrise for a given day / location in PHP.

1039


What is the difference between laravel and php?

879