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 which prints all the odd numbers. Output: 1 3 5 7 9 …

I used while loop in this script with if conditional statement within while. Here I used Mod (%) in if and get results till 55. try this code.
Script to print all odd numbers. 


                          <?php  
                               $num=0;  
                while ($num<=55)  
                               {  
                                         if ($num % 2 == 1)  
                                         {  
                                          echo $num . "<br />";  
                                         }  
                                    $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