Simple programming question of the day, what is c?
int d = 5, c = 10, h = 16, f = 9;
double a = 48, e = 12, g = 3, b = 7;
int main()
{
c += (b + (a / c)) / 6.0;
return 0;
}
a / c = 4.8
4.8 + b = 11.8
11.8 / 6.0 = 1.96666667
c = 10, + 1.96666667 = 11.966666667
BUT
c is an int, so the result is truncated.
Therefore, c=11
And i’m Pretty sure the result would be the same in this case even if the truncation took place earlier in the process.
Last edited by a moderator: