You should set min and max to zero. Otherwise they may contain garbage that mess up things.
Code:
int a, b, c, d, e, min = 0, max = 0;