Q. What will be the output of the following C code?
Code:#include <stdio.h>
int main()
{
float x = 23.456;
printf("%.2f",x);
return 0;
}
β
Correct Answer: (D)
23.46
Explanation: In the above code, the value of x is 23.456 and we are printing the value of x using the %.2f format specifier. %.2f rounds the value and prints the 2 digits after the decimal point.