Hello People, here is another interesting script for you!. Usually these kind of programs you could see in C language only, but in our blog
Hi Students, let’s have another program for you!. Print Diamond star pattern using PHP Script. See the demo here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
<html> <head> <title>PHP Script to print Diamond pattern!</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <h2>PHP Script to print Diamond pattern!</h2> <form method="post"> Enter the limit: <input type="number" name="limit" min="2" max="100" /> <input type="submit" value="Print Diamond Pattern!" name="print" /> </form> </body> </html> <?php //check if the form is submitted if (isset($_POST['print']) && $_POST['print']) { $limit = $_POST['limit']; $space = $limit; for ($i = 1; $i <= $limit; $i++) { for ($j = 1; $j <= $space; $j++) { echo " "; } $space--; for ($j = 1; $j <= 2 * $i - 1; $j++) { echo "*"; } echo "<br>"; } $space = 2; for ($i = 1; $i <= $limit; $i++) { for ($j = 1; $j <= $space; $j++) { echo " "; } $space++; for ($j = 1; $j <= 2 * ($limit - $i) - 1; $j++) { echo "*"; } echo "<br>"; } } ?> |
Output of the above program
Hello friends, Today’s post is about how to print a series of Prime numbers using only JavaScript. This script could help you to understand the
In the previous post we saw how to find an Entered number is a Prime number or not!. In this post we are going to
Hello friends, Let’s see another School / College program that is useful for understanding the basic concepts of PHP. And the PHP script what we
Already I have written a PHP script for the same functionality. Here is the link: PHP Script to find age from Date of Birth (DOB)
Today’s script will be much useful to you and i hope interesting as well. ie., PHP Script to find days between two selected dates. Let’s see
Today we are going to see another useful and interesting PHP script which you may use it in your project as well. That is finding
Friends, This is another school / college script for you. This php program could be useful for the Freshers who are searching for job as
Okay Friends! Today we are going to see another interesting pattern program which is in pure JavaScript. The output of the below program will be