Answers for "printf("%5.1f\n", x);"

C
0

printf("%5.1f\n", x);

#include<stdio.h>

int main()
{
    float a=3.15529;
    printf("%2.1f\n", a);
    return 0;
}


[A].	3.00
[B].	3.15
[C].	
3.2	@
[D].	3
Answer: Option C

Explanation:

float a=3.15529; The variable a is declared as an float data type and initialized to value 3.15529;

printf("%2.1f\n", a); The precision specifier tells .1f tells the printf function to place only one number after the .(dot).

Hence the output is 3.2
Posted by: Guest on May-05-2021
-1

printf("%d", 10 ? 0 ? 5:1:1:12) what will print

printf("%d", 10 ? 0 ? 5:1:1:12)
Posted by: Guest on July-07-2020

Code answers related to "C"

Browse Popular Code Answers by Language