You have a couple of coding errors, but I think the overall algorithm is flawed.
You are attempting to use truncation from floating point to integer to determine if x is evenly divisible by 2. But x % 2 does the same thing without requiring floating point.
Your for loop at the bottom declares b as a short int which is shadowing the declaration of b as a short int at the top of main.