Sandbox

+3
−0

# Challenge

Make a program that takes input of 3 non-negative integers: a result and 2 other values that once calculated results to the 3rd value.

• The program must figure out how to get the 2 first numbers to equivalence itself with the 3rd. It could be either addition, subtraction, multiplication, integer division, modulo and exponentiation.
• You can't change the places of the 2 variables when building the equation, meaning you can't get some value by intertwining in the methods excluding addition and multiplication.
• The returning value is the operator that makes the equation true (it's best to use some distinguishable character to separate it from the other methods).
• Use whatever characters you want to use to determine the method that makes the equation truthy.
• If multiple operators make the equation truthy, then output them in any order.
• What makes it true? If an equation exists within the 2 numbers that results to the value of the 3rd.
• What to return when it's false? Something but not nothing (whitespaces and newlines aren't allowed as such output).
• This is code-golf so the shortest program wins!

# Test Cases

# Input (#, #, #)
// Output (+-*/%^ or .)

2 3 5
+

7 3 2
/

9 8 4
.

1 2 2
*

2 2 4
+ * ^

14 6 8
-

5 0 2
.

0 0 1
^

8 4 0
%

0 0 0
+ - *

Why does this post require moderator attention?
You might want to add some details to your flag.

#### 7 comment threads

Output type (3 comments)
In case multiple operators match (1 comment)
Challenge name idea (1 comment)
General (1 comment)

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!

Like what we're doing? Support us!