4
21/10/2024 1:44 pm
Topic starter
You will receive 3 integers. Write a function sum to get the sum of the first two integers and subtract function that subtracts the third integer from the result from the Sum function.
Examples:
1 Answer
3
21/10/2024 1:45 pm
Here is my answer:
<?php $number1 = intval(readline()); $number2 = intval(readline()); $number3 = intval(readline()); $endResult = addAndSubtract($number1, $number2, $number3); echo $endResult; function addAndSubtract($n1, $n2, $n3) { $result = 0; $result += $n1 + $n2; $result -= $n3; return $result; }