C Programming - Declarations and Initializations - Discussion
Discussion Forum : Declarations and Initializations - General Questions (Q.No. 1)
1.
Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
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 divisions.
Example:
#include <stdio.h>
#include <math.h>
int main ()
{
printf ("fmod of 3.14/2.1 is %lf\n", fmod (3.14,2.1) );
return 0;
}
Output:
fmod of 3.14/2.1 is 1.040000
Discussion:
141 comments Page 3 of 15.
Nagendran said:
2 decades ago
Good explanation
JAY said:
2 decades ago
I think chandra also correct in the sence of maths.
Arvind said:
2 decades ago
%(modulo) operator is in arithmatic
fmod is the c function
fmod is the c function
Sandeep said:
2 decades ago
What Swathy said would be the exact explanation.
Mahesh said:
2 decades ago
What is use of fmod() function ?
Deepak sharma said:
1 decade ago
That is right answer because the given expression is in the floating type formate so witought fmod() is use that not give right answer so fmod() is used.
V!nu said:
1 decade ago
Nice explanation. I agree with that answer.
Pappu said:
1 decade ago
Ya, swathi answer is correct.
Ram krishna said:
1 decade ago
Ya. Its nice ans we use % and mod () , fun for int, type but not for float hence fmode is right answer.
Kavita.C.K said:
1 decade ago
What is the difference between %, mod(), fmod()and modf()?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers