Discussion
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
Answer: C
Correct answer: rem = fmod(3.14, 2.1);
The % operator is defined only for integer operands and will not compile with doubles. fmod from math.h is the floating point equivalent and returns 1.04 here. modf is unrelated - it splits a value into its integer and fractional parts.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development