If you limit chars to ASCII and not unicode then, I like:
http://ideone.com/khacx. (editted in response to comment pointing out I hadn't quite got the specs right, but I still like the basic idea. Added additional test as verification).
using System;
class example {
static void elegant(char a, char b, char c) {
int y = ((int) a - 48) + ((int) b - 48) + ((int) c - 48);
int z = ((int) a - 48) * ((int) b - 48) * ((int) c - 48);
bool result = y == ((int) a-48)*3 || (z ==0 && (a==b || b==c || a==c));
Console.WriteLine(result);
}
static void Main() {
elegant('0', 'b', 'c'); // false
elegant('a', '0', 'c'); // false
elegant('a', 'b', '0'); // false
elegant('a', 'b', 'c'); // false
elegant('0', '0', '0'); // true
elegant('a', 'a', 'a'); // true
elegant('0', 'a', 'a'); // true
elegant('a', '0', 'a'); // true
elegant('a', 'a', '0'); // true
elegant('0', '0', 'a'); // true
elegant('0', 'a', '0'); // true
elegant('a', '0', '0'); // true
}
}
For a more general solution that covers an unlimited number of characters, thats what regexs are for: ^(.)(\1|0)*$