E:G:
float S;
int N = 5;
S = (float) N / 2;
std::cout << S;
It will output to 2.5
if N was 6, then the output was 3.
So, how can i do the same as below with printf? If the number is an integer, how to remove the .00?
float S;
int N = 5;
S = (float) N / 2;
printf("%0.2f", S);
It will output to 2.50. If N was 3 then the output was 3.00. I want to remove .00 when is the case to.
float S;
int N = 5;
S = (float) N / 2;
std::cout << S;
It will output to 2.5
if N was 6, then the output was 3.
So, how can i do the same as below with printf? If the number is an integer, how to remove the .00?
float S;
int N = 5;
S = (float) N / 2;
printf("%0.2f", S);
It will output to 2.50. If N was 3 then the output was 3.00. I want to remove .00 when is the case to.