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
What are the different tables(engine) present in mysql, which one is default?
Tell me what is htaccess?
How do I run a php file?
What is the use of rand() in php?
Explain the difference b/w static and dynamic websites?
How to strip whitespace (or other characters) from the beginning and end of a string?
What is stdclass in php?
Explain what are psrs? Choose 1 and briefly describe it?
Where is session value stored php?
Tell me what is the difference between get and post?
Which library is used in php to do various types of image work?
Write down the code for save an uploaded file using php?
What is the difference server side and browser side validation?
What does pear stand for?
Why do we use csrf token?