0

Как создать калкулятор

31st Jan 2018, 5:17 PM
Бахор Ахмедова
Бахор Ахмедова - avatar
3 Respuestas
+ 6
Подойдет в JS?
1st Feb 2018, 8:57 PM
renamed
renamed - avatar
0
<? $a = $_POST['a']; $b = $_POST['b']; $radio = $_POST['operation']; if ($_POST['button']) { if ($radio=='+'){$c = $a + $b; echo "Ҳосили ҷамъ=" . $c.'<br>';} if ($radio=='-'){$d = $a - $b; echo "Ҳосили тарҳ=" . $d.'<br>';} if ($radio=='*'){$e = $a *$b; echo "Ҳосили зарб=" . $e.'<br>';} if ($radio=='/'){$f = $a / $b; echo "Ҳосили тақсим=" . $f;} } ?> <form method="POST" action=""> <input type="radio" name="operation" value='+'>+<br> <input type="radio" name="operation" value='-'>-<br> <input type="radio" name="operation" value='/'>/<br> <input type="radio" name="operation" value='*'>*<br> А=<input type="text" name="a" required><br><br> В=<input type="text" name="b" required><br><br> <input type="submit" name="button" value="Натиҷа"> </form>
2nd Feb 2018, 1:02 AM
Бахор Ахмедова
Бахор Ахмедова - avatar