A
andthen
Here is the code:
#include <stdio.h>
int main() {
double a = 3.01;
int b = (int)(a * 100.0);
printf("%d",b);
return 0;
}
I believe that the output should be "301", however I am getting output of
"300" when I compile this program on borland's compiler (bcc32) and run it.
I also tried a compiler I got from the internet called lcc, which also leads
to output of "300". I tried Microsoft's compiler and it gave me "301". Does
anyone know what the explanation is for these strange results? Also I do not
have access to gcc right now, but I would be interested to know which output
it gives.
#include <stdio.h>
int main() {
double a = 3.01;
int b = (int)(a * 100.0);
printf("%d",b);
return 0;
}
I believe that the output should be "301", however I am getting output of
"300" when I compile this program on borland's compiler (bcc32) and run it.
I also tried a compiler I got from the internet called lcc, which also leads
to output of "300". I tried Microsoft's compiler and it gave me "301". Does
anyone know what the explanation is for these strange results? Also I do not
have access to gcc right now, but I would be interested to know which output
it gives.