(C language) condition calculation