LearnFrenzy
Sign in Take a free test

Declarations and Initializations · Declarations MCQ · Question 8

How to get the remainder of 3.14 divided by 2.1 in C Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 8 Back to Exercise

Which expression gives the remainder after dividing 3.14 by 2.1?

  • A 3.14 % 2.1
  • B fmod(3.14, 2.1) Correct
  • C mod(3.14, 2.1)
  • D rem(3.14, 2.1)
Correct Answer: Option B

% is only defined for integers. fmod() from <math.h> returns the floating-point remainder: 1.04.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links