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 12 of 15.
Dipak said:
1 decade ago
I think, an % sign also can done it !
Renu said:
8 years ago
Modulus & division are different.
Saikiran said:
1 decade ago
What Prem Kumar comented is correct.
Varadaraj said:
7 years ago
As per my knowledge, it is option A.
Gautam said:
1 decade ago
Please explain fmod() and modf ().
Vikas said:
1 decade ago
What is the use of return 0 there?
Mahesh said:
1 decade ago
What is use of fmod() function ?
Asif sadrul said:
1 decade ago
@Ayapan.
Use %f instead of %d.
Use %f instead of %d.
Amarjeet said:
8 years ago
I think the answer A is correct.
Abhishek said:
1 decade ago
Thanks Anitha for your Answer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers