C Programming - Floating Point Issues - Discussion
Discussion Forum : Floating Point Issues - General Questions (Q.No. 5)
5.
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;
}
Answer: Option
Explanation:
math.h is a header file in the standard library of C programming language designed for basic mathematical operations.
Declaration syntax: double log(double);
Discussion:
14 comments Page 2 of 2.
Varun said:
1 decade ago
What should be added here (in this case) to make output correct.
Well wisher said:
1 decade ago
Kumar is correct.
Kumar said:
2 decades ago
Since C is a compiler dependent language, it may give different outputs at different platforms. Here the Turbo-C Compiler (Windows) output has been given.
Please try the above programs in Windows (Turbo-C Compiler) and Linux (GCC Compiler), you will understand the difference better.
Please try the above programs in Windows (Turbo-C Compiler) and Linux (GCC Compiler), you will understand the difference better.
Vinay Airan said:
2 decades ago
#include<stdio.h>
#include<math.h>
int main()
{
printf("%f\n", log(36.0));
return 0;
}
While i compile this code there is an error like..
In function `main':
undefined reference to `log'
why??
#include<math.h>
int main()
{
printf("%f\n", log(36.0));
return 0;
}
While i compile this code there is an error like..
In function `main':
undefined reference to `log'
why??
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers