Post History
C (gcc), 41 bytes f(x,y){int r=x*y;return r&&r==x+y?5:x+y;} Attempt This Online!
Answer
#8: Post edited
# [C (GCC)](https://gcc.gnu.org), 41 bytes- ```c
- f(x,y){int r=x*y;return r&&r==x+y?5:x+y;}
- ```
- [Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6Fjc10zQqdCo1qzPzShSKbCu0Kq2LUktKi_IUitTUimxtK7Qr7U2tgKR1LVTDQ5DK3MTMPI2y_MwUTa5qLs6CIqBYmoaSakpMnpKOQpqGgY6CgaamNRYZQx0FI-wyRhAZBX19Bf_8_IJiRQUjBW0gtlUwVbDSxK7BGLtRxjoKJthlTHUUTHE4zBJongVIDurRBQsgNAA)
- # [C (gcc)](https://gcc.gnu.org), 41 bytes
- ```c
- f(x,y){int r=x*y;return r&&r==x+y?5:x+y;}
- ```
- [Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6Fjc10zQqdCo1qzPzShSKbCu0Kq2LUktKi_IUitTUimxtK7Qr7U2tgKR1LVTDQ5DK3MTMPI2y_MwUTa5qLs6CIqBYmoaSakpMnpKOQpqGgY6CgaamNRYZQx0FI-wyRhAZBX19Bf_8_IJiRQUjBW0gtlUwVbDSxK7BGLtRxjoKJthlTHUUTHE4zBJongVIDurRBQsgNAA)
#7: Post edited
# [C (gcc)](https://gcc.gnu.org), 28 bytes``` Cf(x,y){return x*y==4?5:x+y;}- ```
[Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6FnvSNCp0KjWri1JLSovyFCq0Km1tTexNrSq0K61rIUpuPszMK1HITczM0yjLz0zR5Krm4iwoAoqlaSippsTkKekopGkY6CgYaGpaY5Ex1FEwwi5jBJFR0NdX8M_PLyhWVDBS0AZiWwVTBStN7BqMsRtlrKNggl3GVEfBFIfDLIHmWYDkoB5dsABCAwA)This solution is based on the simple fact that:$$x \in \mathbb{N}, y \in \mathbb{N}$$$$x=2, y=2 \Longrightarrow x \times y = 4 \text{ and } x + y = 5 \text{ (exception)}$$$$x=1, y=4 \Longrightarrow x \times y = 4 \text{ and } x + y = 5 \text{ (deduction)}$$$$x=4, y=1 \Longrightarrow x \times y = 4 \text{ and } x + y = 5 \text{ (deduction)}$$but not on _tricky_ binary operators.
- # [C (GCC)](https://gcc.gnu.org), 41 bytes
- ```c
- f(x,y){int r=x*y;return r&&r==x+y?5:x+y;}
- ```
- [Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6Fjc10zQqdCo1qzPzShSKbCu0Kq2LUktKi_IUitTUimxtK7Qr7U2tgKR1LVTDQ5DK3MTMPI2y_MwUTa5qLs6CIqBYmoaSakpMnpKOQpqGgY6CgaamNRYZQx0FI-wyRhAZBX19Bf_8_IJiRQUjBW0gtlUwVbDSxK7BGLtRxjoKJthlTHUUTHE4zBJongVIDurRBQsgNAA)
#6: Post edited
- # [C (gcc)](https://gcc.gnu.org), 28 bytes
- ``` C
- f(x,y){return x*y==4?5:x+y;}
- ```
[Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6FnvSNCp0KjWri1JLSovyFCq0Km1tTexNrSq0K61rIUpuPszMK1HITczM0yjLz0zR5Krm4iwoAoqlaSippsTkKekopGkY6CgYaGpaY5Ex1FEwwi5jBJFR0NdX8M_PLyhWVDBS0AZiWwVTBStN7BqMsRtlrKNggl3GVEfBFIfDLIHmWYDkoB5dsABCAwA)
- # [C (gcc)](https://gcc.gnu.org), 28 bytes
- ``` C
- f(x,y){return x*y==4?5:x+y;}
- ```
- [Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6FnvSNCp0KjWri1JLSovyFCq0Km1tTexNrSq0K61rIUpuPszMK1HITczM0yjLz0zR5Krm4iwoAoqlaSippsTkKekopGkY6CgYaGpaY5Ex1FEwwi5jBJFR0NdX8M_PLyhWVDBS0AZiWwVTBStN7BqMsRtlrKNggl3GVEfBFIfDLIHmWYDkoB5dsABCAwA)
- This solution is based on the simple fact that:
- $$x \in \mathbb{N}, y \in \mathbb{N}$$
- $$x=2, y=2 \Longrightarrow x \times y = 4 \text{ and } x + y = 5 \text{ (exception)}$$
- $$x=1, y=4 \Longrightarrow x \times y = 4 \text{ and } x + y = 5 \text{ (deduction)}$$
- $$x=4, y=1 \Longrightarrow x \times y = 4 \text{ and } x + y = 5 \text{ (deduction)}$$
- but not on _tricky_ binary operators.
#3: Post edited
- # [C (gcc)](https://gcc.gnu.org), 28 bytes
- ``` C
- f(x,y){return x*y==4?5:x+y;}
- ```
[Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6FnvSNCp0KjWri1JLSovyFCq0Km1tTexNrSq0K61rIUpuPszMK1HITczM0yjLz0zR5Krm4iwoAoqlaSippsTkKekopGkY6CgYaGpaY5Ex1FEwwi5jBJFR0NdX8M_PLyhWVDBS0AZiWwVTBStN7BqMsRtlrKNggl3GVEfBFIfDLIHmWYDkoB5dsABCAwA)This solution is based on the simple fact that:$$x \in \mathbb{N}, y \in \mathbb{N}$$$$x=2 \text{ and } y=2 \Longleftrightarrow x \times y=4$$but not on _tricky_ binary operators.
- # [C (gcc)](https://gcc.gnu.org), 28 bytes
- ``` C
- f(x,y){return x*y==4?5:x+y;}
- ```
- [Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6FnvSNCp0KjWri1JLSovyFCq0Km1tTexNrSq0K61rIUpuPszMK1HITczM0yjLz0zR5Krm4iwoAoqlaSippsTkKekopGkY6CgYaGpaY5Ex1FEwwi5jBJFR0NdX8M_PLyhWVDBS0AZiWwVTBStN7BqMsRtlrKNggl3GVEfBFIfDLIHmWYDkoB5dsABCAwA)
#1: Initial revision
# [C (gcc)](https://gcc.gnu.org), 28 bytes ``` C f(x,y){return x*y==4?5:x+y;} ``` [Attempt This Online!](https://ato.pxeger.com/run?1=m700OT49OXnBJuXMvOSc0pRUBZvikpTMfL0Mu6WlJWm6FnvSNCp0KjWri1JLSovyFCq0Km1tTexNrSq0K61rIUpuPszMK1HITczM0yjLz0zR5Krm4iwoAoqlaSippsTkKekopGkY6CgYaGpaY5Ex1FEwwi5jBJFR0NdX8M_PLyhWVDBS0AZiWwVTBStN7BqMsRtlrKNggl3GVEfBFIfDLIHmWYDkoB5dsABCAwA) This solution is based on the simple fact that: $$x \in \mathbb{N}, y \in \mathbb{N}$$ $$x=2 \text{ and } y=2 \Longleftrightarrow x \times y=4$$ but not on _tricky_ binary operators.