Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
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; }
0
0.0
7.0
7
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!
Name:
Comment:
Post Comment
Join Discussion
Discussion & Comments