C Programming - Control Instructions - Discussion
Discussion Forum : Control Instructions - True / False Questions (Q.No. 3)
3.
The modulus operator cannot be used with a long double.
Answer: Option
Explanation:
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.
Discussion:
5 comments Page 1 of 1.
Ruby said:
1 decade ago
example for fmod:
#include<stdio.h>
#include<math.h>
int main()
{
float x=10.10,y=2.0, z;
z=fmod(x,y);
printf("%f", z);
return 0;
}
#include<stdio.h>
#include<math.h>
int main()
{
float x=10.10,y=2.0, z;
z=fmod(x,y);
printf("%f", z);
return 0;
}
Snehal said:
1 decade ago
Is this means that modulus operator works ONLY on integers?
Darshan patel said:
10 years ago
It is not possible to perform modulo operator with float and double.
Pranouti said:
9 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.
I think the answer is B.
Udhaya Sankar said:
10 months ago
Here the question is about operator and not about function.
So make the solution clear.
So make the solution clear.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers