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


Leave a comment

Parsed as Markdown

Login to leave a comment