Home » C Programming » Floating Point Issues

What will be the output of the program? #include int main() { float fval=7.29; printf("%d\n", (int)fval); return 0; }

Correct Answer: 7

Explanation:

printf("%d\n", (int)fval); It prints '7'. because, we typecast the (int)fval in to integer. It converts the float value to the nearest integer value.

← Previous Question

More Questions from Floating Point Issues

Discussion & Comments

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