0

Why these two codes return different values?

// #1
// a = 11, b = 24, output = 17.5
printf("Avg: %.1f\n", (float)(a + b) / 2);

// #2
// a = 11, b = 24, output = 17.0
printf("Avg: %.1f\n", (float)((a + b) / 2));

I know the problem is in executing, that some thing will be executed first, but that's all I know.

John Doe
  • 1
  • 1

0 Answers0