C Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - True / False Questions (Q.No. 3)
The modulus operator cannot be used with a long double.
Answer: Option

fmod(x,y) - Calculates x modulo y, the remainder of x/y.
This function is the same as the modulus operator. But fmod() performs floating point or long double divisions.

4 comments Page 1 of 1.

Pranouti said:   8 years ago
If I am right, fmod(x,y) is a function. And the question is "The modulus operator cannot be used with a long double". Then the answer should be (B). Because we can not use modulus operator with float or double. For this, we use the function in math.h header file which is fmod().

I think the answer is B.

Darshan patel said:   8 years ago
It is not possible to perform modulo operator with float and double.

Snehal said:   1 decade ago
Is this means that modulus operator works ONLY on integers?

Ruby said:   1 decade ago
example for fmod:
int main()
float x=10.10,y=2.0, z;
printf("%f", z);

return 0;

Post your comments here:

Your comments will be displayed after verification.