Computer Science, asked by TbiaSamishta, 1 year ago

if x = 12.4568, what value will be printed, if the printf() function is used as?
printf( "%.3f", x);

Answers

Answered by Secondman
1

"If x = 12.4568 and the printf function is used as follows:

printf(""%.3f"",x);

Then the value which will be printed on the screen is 12.456. This will happen because of the format specifier inside the printf() function.

Format specifiers are used inside a printf statement to represent what type of data will be described via that particular statement and how it will be displayed.

In the given example, the format specifier used is .3f which means that a floating point value with a precision of only 3 decimal digits will be printed."

Similar questions