Sail E0 Webinar
Question


What will be the output of the program?


#include<stdio.h>
int main()
{
float fval=7.29;
printf("%d\n", (int)fval);
return 0;
}
Options:
A .  0
B .  0.0
C .  7.0
D .  7
Answer: Option D

printf("%d`setminus`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.




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers