Download Android App in your Android Device from Google Play Store
- Search for "Withoutbook Practice Exam Test" in Mobile/Tablet Play Store
Practice InterviewNew Search by Name or Email

Exams Attended

Make Homepage

Bookmark this page

Subscribe Email Address

Language in C Interview Questions and Answers

Ques. How to extract the integer part and a fractional part of a floating point number?

Ans. C function modf( ) can be used to get the integer and fractional part of a floating point.

#include "math.h"

main( )
{
double val, i, f ;
val = 5.15 ;
f = modf ( val, &i ) ;
printf ( "\nFor the value %f integer part = %f and fractional part = %f",
val, i, f ) ;
}

The output of the above program will be:

For the value 5.150000 integer part = 5.000000 and fractional part =
0.150000
Is it helpful? Yes No

Most helpful rated by users:

©2020 WithoutBook