How to take only two decimals of float without rounding?
Hi I am brand new to C and am trying to understand how the float and double variables work. What I am trying to do is initialize a variable to say, x = 6.789. And then from there just print out a basic statement such as:
printf("The furniture cost $ %.2f", x);
However whenever I do this it always rounds the variable to $6.79. Is there a way to make it say $6.78? I just need help understanding how it works, if anyone could just get me started that would be great.
IGNORE THREAD: It was a very basic understanding assignment I was working on but the teacher has announced a there was a typo which solves my problem, I would delete the thread but im not sure how, sorry.