[Software Technologies] PHP - 4. Product of 3 Numbers
4.Product of 3 Numbers
You are given a number num1, num2 and num3. Write a PHP script that finds if num1 * num2 * num3 (the product) is negative or positive. Try to do this WITHOUT multiplying the 3 numbers.
The input comes as parameters named num1, num2 and num3.
Examples
| Parameters name | Input | Output | 
 | Input | Output | 
 | Input | Output | 
| num1 | 2 | Negative | 
 | 5 | Positive | -3 | Positive | |
| num2 | 3 | 
 | 4 | -4 | ||||
| num3 | -1 | 
 | 3 | 5 | 
Hints
- Count the negative numbers. If they are odd number, the result will be negative, otherwise à positive.
- Special case: one of the numbers is 0 à the product is positive.
Ето ми го решението http://pastebin.com/xpDbutYK
Не мога да докарам специалния случай. Някой идеи ?
Мерси.
А знаете ли с in_array защо не работи ? Явно не го използвам както трябва.