Home » C Programming » Input / Output

What will be the output of the program? #include int main() { float a=3.15529; printf("%2.1f\n", a); return 0; }

Correct Answer: 3.2

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


← Previous Question Next Question→

More Questions from Input / Output

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion