#include Declaration syntax: double log(double);
Example: Output: y = (int)(x + 0.5); here x is any float value. To roundoff, we have to typecast the value of x by using (int) Example: Output:
Comments
Copyright ©CuriousTab. All rights reserved.Discussion
Home
‣
C Programming
‣
Floating Point Issues
Comments
Which statement will you add in the following program to work it correctly?
#include<stdio.h>
int main()
{
printf("%f\n", log(36.0));
return 0;
}
Options
Explanation
Floating Point Issues problems
Search Results
Options
Correct Answer: Depends on big endian or little endian architecture
Options
Correct Answer: 3.4E-4932 to 1.1E+4932
Explanation:
Options
Correct Answer: rem = fmod(5.5, 1.3)
Explanation:
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 5.5 by 1.3 is %lf\n", fmod (5.5, 1.3) );
return 0;
}
fmod of 5.5 by 1.3 is 0.300000
Options
Correct Answer: y = (int)(x + 0.5)
Explanation:
#include <stdio.h>
int main ()
{
float x = 3.6;
int y = (int)(x + 0.5);
printf ("Result = %d\n", y );
return 0;
}
Result = 4.
Options
Correct Answer: 101.011
Options
Correct Answer: float, double, long double
Explanation:
char *arr[10];
Options
Correct Answer: arr is a array of 10 character pointers.
int (*pf)();
Options
Correct Answer: pf is a pointer to a function which return int
"An array of three pointers to chars".
Optionschar *ptr[3]();
char *ptr[3];
char (*ptr[3])();
char **ptr[3];
Correct Answer: char *ptr[3];
int *f();
Options
Correct Answer: f is a function returning pointer to an int.
More in C Programming:
Programming