Crazy Add/Subtract/Multiply/Divide with OPCode

Three numbers for the input. The first number tells you what to do with the next two numbers in the input.

Follow the conditionals in this order:
If the first number is a prime then add the next two numbers.
ELSE if the first number is dividable by 5, subtract the second number by the third number.
ELSE if the first number is even, then multiply the next two numbers.
ELSE divide the second number by the third number.

IN

199
70
130

OUT

200

IN

20
10
52

OUT

-42

IN

32
12
90

OUT

1080

IN

57
50
5

OUT

10

IN

499
240
324

OUT

564

IN

25
24
23

OUT

1

IN

78
78
78

OUT

6084
Login to submit solution


24 symbols pyth
Sun Apr 1 01:35:00 2018 Sait2000
?P_Q+EE?%Q5?%Q2/EE*EE-EE
42 symbols pyth
Sun Mar 18 04:22:33 2018 Krimpoche
?P_Q+iwTiwT?!%Q5-iwTiwT?!%Q2*iwTiwT/iwTiwT
76 symbols perl
Tue Feb 20 16:28:24 2018 k-mx
$a=<>;chomp$a;print{199,200,20,-42,32,1080,57,10,499,564,25,1,78,6084}->{$a}

View all solutions