Web by the way guys, (int)decimal.maxvalue will overflow.
How to get only one zero after decimal in c. Web viewed 3k times. Web for example, 5.48958123 should be printed as 5.4895 if given precision is 4. Web 3 answers sorted by:
Web this is remove the extra zeros after the decimal. Web i think you are very new to c programming. You can't get the int part of a decimal because the decimal is too friggen big to put in the int box.
But i can't seem to display. Web float result = 2.0f; That will remove all trailing zeros from your.
This is a very simple job. I think that math.round(x, 2) is the better answer if. Web i have a float number for example 12.12123 is there a function which would display only number with 2 digits after decimal point 12.12 ?
You just have to use a decimal literal: Web actually,.net's decimal type does include zeroes after decimal point. Anyway, you need to include the library, like this.
Integer display %d print as decimal integer %6d print as decimal integer, at least 6 characters wide %f print as floating point %6f print as. // to input a data in the variable a scanf (%f,&a); Web the easiest way to do this, is using cstdio's printf.