Hi everyone.
This is a very easy question ( or so it seems ).
Here is a short piece of code:
#include <stdio.h>
int main() {
int Phase = 3;
double kva = 1000;
if( kva > (1000 * (Phase / 3.0)) )
printf("greater than"
else
printf("less than"
return 1;
}
I am compiling this program under Borland C++ 5.02.
The funny thing is that a trace of the program reveals the expression ( kva > (1000 * (Phase / 3.0)) ) to be false. Yet the resulting output is "greater than".
Can anyone explain why?
Thanks
This is a very easy question ( or so it seems ).
Here is a short piece of code:
#include <stdio.h>
int main() {
int Phase = 3;
double kva = 1000;
if( kva > (1000 * (Phase / 3.0)) )
printf("greater than"
else
printf("less than"
return 1;
}
I am compiling this program under Borland C++ 5.02.
The funny thing is that a trace of the program reveals the expression ( kva > (1000 * (Phase / 3.0)) ) to be false. Yet the resulting output is "greater than".
Can anyone explain why?
Thanks