Declarations and Initializations - General Questions :: Discussion


1.Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
A.rem = fmod(3.14, 2.1);
B.rem = 3.14 % 2.1;
C.rem = modf(3.14, 2.1);
D.Remainder cannot be obtain in floating point division
Answer:  Option  A
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.


#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; }

Tutorial Link:
Published by:Michael Daani

Comments are not available

Post your comments here:

Optional

Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers