I have this program:
I know in reality the answer could be .82 rounding 2 decimal places.Code:#include <stdio.h> int main() { float x; x = 1+2-3*4/5-6+7*8/9; printf("%.2lf\n", 1+2-3*4/5-6+7*8/9); printf("%.2lf\n", x); system("PAUSE"); return 0; }
however, the output of my current program is
0.00
1.00
I expected the outputs to be the same. Could someone guide me to understanding these outputs, and how I could manipulate the program more to get actual values?
I hope someone can help, Thank you!