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 7 of 15.
BDP said:
1 decade ago
% operator is not use for floating operations it is only used for integers.
Grub said:
1 decade ago
fmod() outdated and is not supported by gcc compilers hence answer is(D).
Bhargav dave said:
8 years ago
Hello, I am new on this.
Can anyone explain to me how this program work?
Can anyone explain to me how this program work?
HAMIR BHARWAD said:
1 decade ago
fmod(x,y) function is used to get remainder of floating point divisions.
Prasann said:
1 decade ago
For floating point operator % cannot be used. Only operator/can be used.
Md imran khan said:
1 decade ago
Which function is called global and local function? Can anybody help me?
Karthi said:
9 years ago
What does the fmod represent here?
How could the answer be c but not a?
How could the answer be c but not a?
Vishnu said:
1 decade ago
Please any one can help me how to execute program using gcc compiler ?
Shakir Baba said:
1 decade ago
Why array's base address is initialized to 0 and it terminates on -1?
Ayesha said:
2 years ago
Option D is right because the floating point is not applicable for %.
(10)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers