can someone explain me what is the meaning of the number after the modulo (%)
EX. printf("the number is: %10.2f", number);
please help me define and understand the number after the % and give example, thanks!
can someone explain me what is the meaning of the number after the modulo (%)
EX. printf("the number is: %10.2f", number);
please help me define and understand the number after the % and give example, thanks!
In the case of %f, it's the field width and precision.
The field width specifies the minimum number of characters that will be printed. The field will be padded with whitespace if the value is smaller than the field width. If it's larger, nothing special happens.
The precision specifies the number of digits to print after the radix. At 2, if your variable is 1.2132, only 1.21 will be printed.
can someone explain me what is the meaning of the number after the modulo (%)
EX. printf("the number is: %10.2f", number);
please help me define and understand the number after the % and give example, thanks!
Hello, with %10.2 you specify the format in which your float number will be printed. Your number (including dot) will occupy 10 digits and decimal part will occupy 2 digits. I hope i helped..
tnx :D