to output Response: *number*?" />
S
S
Stackover2021-11-17 20:23:01
PHP
Stackover, 2021-11-17 20:23:01

How to fix the result Response: $Result"; //Response ?> to output Response: *number*?

Connected the PHP library "extension = php_gmp.dll in php.ini" to use the factorial calculation function. Tried: in one line with <?php after ; write a library, remove ; , but then the error "Parse error: syntax error, unexpected token "=" in ...(the path of the file that I checked and it is correct) ... on line 2"; tried without ; one line after <?php .

Who cares why I use for inside the while loop, then this is for the task - Using the while loop, you need to develop a script that will calculate the sum of numbers that are evenly divisible by 5. The loop must be set from 0 to the entered number through an HTML form.

HTML:

<!DOCTYPE html>
<HTML lang= "ru">
<html>
<head>
  <meta charset="utf-8">
  <title> Цикл while </title>
</head>
<body>
    <form name="7" action="2 (7).php" method ="POST">
    <label> Введите своё число: </label> <br/>
    <input type = "text" name= "Chislo"> <br/>
    <input type = "submit" name= "Gotovo" value= "Нажми"/>
    </form>

</body>
</html>


PHP:
<?php
    extension = php_gmp.dll in php.ini //Подключение библиотеки для функции факториала
    
    
        while (0 <= $_POST["Chislo"]) 
        {
            
            for ($Schot = 0; $Schot < $_POST["Chislo"]; $Schot++) 
            $Result = gmp_fact($Schot) / 5;
        }
        echo "<br/>Ответ: $Result"; //Ответ 
        
        
    ?>


Answer:
61953864099d7469381296.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
no_one_safe, 2021-11-18
@no_one_safe

extension = php_gmp.dll in php.ini
Libraries are connected in the php.ini file in the form
extension = php_gmp.dll

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question