0
#include <stdio.h> int main() { printf("Color: %s, Number: %d, float: %5.2f \n", "red", 42, 3.14159);
why my float out put is 3.14?
4 odpowiedzi
+ 5
You wrote .2. That means 2 decimal places.
+ 4
%5.2f
that number 2 is the reason why your number has two decimal places.
https://code.sololearn.com/crf7R7QxVRqW/?ref=app
+ 3
That defines the width on with your number is placed.
Try it out with larger values, you'll quickly see what it does!
0
what is the use of 5 then?