Skip to main content
3 of 6
added 179 characters in body
betseg
  • 8.7k
  • 3
  • 28
  • 60

C and C++, 117 bytes

-10 bytes thanks to @Steadybox!

#include<stdio.h>
int f(int a,int b){auto c=.5;a-b&&printf("%d %d",c?b<a?b:a:a>b?a:b,c?a-b>0?a-b:b-a:a+b);}

Explanation: In C, auto c=.5 declares an integer variable with the auto storage class (which is the default), which is then initialized to 0, whereas in C++11 it declares a double, which is initialized to 0.5. So the variable's value will be truthy in C++ and falsy in C.

C: Try it online!

C++: Try it online!

betseg
  • 8.7k
  • 3
  • 28
  • 60