#include <stdio.h>
int main(void)
{
int c;
float d = 5.6, e = 8.4;
c = d + e;
printf("c = d + e = %.2f \n", (float)c);
return 0;
}
Isn't float d=5.6
and float=8.4
automatically converted to int, so it becomes 5 and 8, respectively?
c=5+8=13
does not come out, and the value keeps coming out as 14...
In c=d+e;
, the =
operator has the lowest priority.
Therefore, d+e
is calculated first, and then the result is substituted for c
.
That is, 14.0 which is the sum of 5.6 and 8.4 is substituted for c.
581 PHP ssh2_scp_send fails to send files as intended
571 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
578 Understanding How to Configure Google API Key
910 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.