1

<!DOCTYPE html>
<html>
<body>

    <?php
        echo "Write your name";
    ?>

</body>
</html>

2


<html>
<body>
    <form>
        <p>Enter principal amount</p>
        <input type="number" name="p" required>

        <p>Enter rate of interest per year</p>
        <input type="number" name="r" required>

        <p>Enter time period in years</p>
        <input type="number" name="t" required>

        <input type="submit" name="sub" value="Submit">
    </form>

    <?php
    if (isset($_REQUEST['sub'])) {
        $p = $_REQUEST['p'];
        $r = $_REQUEST['r'];
        $t = $_REQUEST['t'];

        $si = ($p * $r * $t) / 100;
        echo "<h2>Simple Interest = $si</h2>";
    }
    ?>
</body>
</html>

3


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <?php
        $side1 = 2;
        $side2 = 3;
        $area = $side1 * $side2;
        echo "<p>Area of rectangle: $area</p>";
    ?>
</body>
</html>

4


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <?php
        $first = "Hello";
        $second = "World";

        echo $first . " " . $second; // Output: Hello World
    ?>
</body>
</html>

5


<html>
<head>
    <title></title>
</head>
<body>
    <form method="post">
        <p>Enter 1st number:</p>
        <input type="number" name="num1">

        <p>Enter 2nd number:</p>
        <input type="number" name="num2">

        <p>Enter 3rd number:</p>
        <input type="number" name="num3">

        <br><br>
        <input type="submit" value="Check">
    </form>

    <?php
    if (isset($_POST['num1']) && isset($_POST['num2']) && isset($_POST['num3'])) {
        $a = $_POST['num1'];
        $b = $_POST['num2'];
        $c = $_POST['num3'];

        if ($a > $b && $a > $c) {
            echo "<h1>A is biggest: $a</h1>";
        } else if ($b > $a && $b > $c) {
            echo "<h1>B is biggest: $b</h1>";
        } else {
            echo "<h1>C is biggest: $c</h1>";
        }
    }
    ?>
</body>
</html>

6


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <form method="post">
        <p>Enter a number:</p>
        <input type="number" name="num" required>
        <br><br>
        <input type="submit" name="sub" value="Check">
    </form>

    <?php
    if (isset($_POST['sub'])) {
        $n = $_POST['num'];
        if ($n % 2 == 0) {
            echo "<h3>$n is Even</h3>";
        } else {
            echo "<h3>$n is Odd</h3>";
        }
    }
    ?>
</body>
</html>

7


<html>
<head>
    <title></title>
</head>
<body>
    <form>
        <p>Enter 1 number:</p>
        <input type="number" name="num1">
        <p>Enter 2 number:</p>
        <input type="number" name="num2">
        <input type="submit" name="sub" value="Check">
    </form>

    <?php
    if (isset($_REQUEST['sub'])) {
        $num1 = $_REQUEST['num1'];
        $num2 = $_REQUEST['num2'];

        if ($num1 == $num2) {
            echo "<h1>$num1 and $num2 are equal</h1>";
        } else {
            echo "<h1>$num1 and $num2 are not equal</h1>";
        }
    }
    ?>
</body>
</html>

8


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <form method="post">
        <p>Enter your name:</p>
        <input type="text" name="name" required>
        <input type="submit" name="sub" value="Convert">
    </form>

    <?php
    if (isset($_REQUEST['sub'])) {
        $name = strtoupper($_REQUEST['name']); // Convert to uppercase for consistency
        $length = strlen($name);
        echo "<h3>Converted Result:</h3><p>";

        for ($i = 0; $i < $length; $i++) {
            $char = $name[$i];

            // Check if it's an alphabet character
            if (ctype_alpha($char)) {
                $number = ord($char) - 64; // A=65 in ASCII, so A - 64 = 1
                echo "$char = $number<br>";
            } else {
                echo "$char is not a letter<br>";
            }
        }

        echo "</p>";
    }
    ?>
</body>
</html>

9


<html>
<head>
    <title></title>
</head>
<body>
    <form method="post">
        <p>Enter a number (1-12):</p>
        <input type="number" name="num1" required>
        <br><br>
        <input type="submit" name="sub" value="Submit">
    </form>

    <?php
    if(isset($_REQUEST['sub'])) {
        $ch = $_REQUEST['num1'];
        switch($ch) {
            case 1:
                echo "January";
                break;
            case 2:
                echo "February";
                break;
            case 3:
                echo "March";
                break;
            case 4:
                echo "April";
                break;
            case 5:
                echo "May";
                break;
            case 6:
                echo "June";
                break;
            case 7:
                echo "July";
                break;
            case 8:
                echo "August";
                break;
            case 9:
                echo "September";
                break;
            case 10:
                echo "October";
                break;
            case 11:
                echo "November";
                break;
            case 12:
                echo "December";
                break;
            default:
                echo "Invalid number. Please enter a number between 1 and 12.";
        }
    }
    ?>
</body>
</html>

10


<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
	<?php
        for($i=1; $i<=10; $i++) 
        {
            echo "$i Hello <br>";
        }
	?>
</body>
</html>

11


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <form method="post">
        <h3>Enter 10 numbers:</h3>

        <?php
        for ($i = 1; $i <= 10; $i++) {
            echo "Number $i: <input type='number' name='num[]' required><br><br>";
        }
        ?>

        <input type="submit" name="sub" value="Calculate Sum">
    </form>

    <?php
    if (isset($_POST['sub'])) {
        $numbers = $_POST['num'];
        $sum = 0;

        foreach ($numbers as $n) {
            $sum += $n;
        }

        echo "<h2>The sum of the 10 numbers is: $sum</h2>";
    }
    ?>
</body>
</html>

12


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <h2>Multiplication Table of 10</h2>

    <?php
    $num = 10;

    for ($i = 1; $i <= 10; $i++) {
        $result = $num * $i;
        echo "$num x $i = $result<br>";
    }
    ?>
</body>
</html>

13


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <h2>Even Numbers Between 1 and 100:</h2>

    <?php
    for ($i = 1; $i <= 100; $i++) {
        if ($i % 2 == 0) {
            echo "$i ";
        }
    }
    ?>
</body>
</html>

14


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <h2>Factorial Calculator</h2>
    <form method="post">
        <label>Enter a number:</label>
        <input type="number" name="num" min="0" required>
        <input type="submit" name="sub" value="Calculate">
    </form>

    <?php
    if (isset($_POST['sub'])) {
        $num = $_POST['num'];
        $factorial = 1;

        if ($num == 0 || $num == 1) {
            $factorial = 1;
        } else {
            for ($i = 2; $i <= $num; $i++) {
                $factorial *= $i;
            }
        }

        echo "<h3>Factorial of $num is: $factorial</h3>";
    }
    ?>
</body>
</html>

15


<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <?php
        echo "<h1>1</h1>";
        for($i=0; $i<=5; $i++)
        {
            for($j=0; $j<=$i; $j++)
            {
                echo " *";
            }
            echo "<br>";
        }

        echo "<h1>2</h1>";
        for($i=1; $i<=5; $i++)
        {
            for($j=1; $j<=$i; $j++)
            {
                echo " $j";
            }
            echo "<br>";
        }

        echo "<h1>3</h1>";
        for($i=1; $i<=5; $i++)
        {
            for($j=1; $j<=$i; $j++)
            {
                echo " $i";
            }
            echo "<br>";
        }

        echo "<h1>4</h1>";
        for($i='A'; $i<='E'; $i++)
        {
            for($j='A'; $j<=$i; $j++)
            {
                echo " $j";
            }
            echo "<br>";
        }
    ?>
</body>
</html>