Subscribe To Our Newsletter

Sign Up Now To Get SEO and Programming Tips

We Hate Spam! Really, It's terrible and we never do it.

Write a script that calculates and prints the sum of the integers from 1 to 10. Use a while statement to loop through the calculation and increment statements. The loop should terminate when the value of x becomes 11.

I used ; while loop for it and used if condition within while loop and add break for 1st loop.
code is given bellow understand it.


                          <?php  
                $num = 0;  
                               while ($num+1)  
                                    {  
                                         echo $num . "<br />";  
                                              if ($num==10)  
                                              {  
                                                   break 1;  
                                              }  
                                         $num++;  
                                    }  
                          ?>  
Share this article :

Post a Comment

Give your reviews about this blog. Leave your comments. what do you think about this post?

Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe FusionMarketPro.online blog.

---------------------------------------
Thanks for visiting FusionMarketPro.Online.
==========================================
Join Sami Jeweller and Shop online jewelry for your someone special.
==========================================
Best Regards

 
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger