IndiaBIX.com
Arithmetic Aptitude Data Interpretation
Logical Reasoning Verbal Reasoning Non Verbal Reasoning
General Knowledge
Sudoku Number puzzles Missing letters puzzles Logical puzzles Playing cards puzzles Clock puzzles
C Programming C# Programming Java Programming
Networking Database Questions Computer Science Basic Electronics Digital Electronics Electronic Devices Circuit Simulation Electrical Enigneering Engineering Mechanics Technical Drawing
Placement Papers Group Disucssion HR Interview Technical Interview Body Language
Aptitude Test Verbal Ability Test Verbal Reasoning Test Logical Reasoning Test C Programming Test Java Programming Test Data Interpretation Test General Knowledge Test
Data Structures Operating Systems Networking DATABASE Database Basics SQL Server Basics SQL Server Advanced SQL Server 2008 JAVA Core Java Java Basics Advanced Java UNIX Unix File Management Unix Memory Management Unix Process Managemnt C Interview Questions The C Language Basics .NET Interview Questions .NET Framework ADO.NET ASP.NET Software Testing

C Programming - Floating Point Issues - Discussion

@ : Home > C Programming > Floating Point Issues > General Questions - Discussion

Read more:

"You cannot shake hands with a clenched fist."
- Indira Gandhi
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;
}

[A]. #include<conio.h>[B]. #include<math.h>
[C]. #include<stdlib.h>[D]. #include<dos.h>

Answer: Option D

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);


Vinay Airan said: (Tue, Jul 20, 2010 09:35:52 AM)    
 
#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??

Kumar said: (Wed, Jul 21, 2010 12:53:27 AM)    
 
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.

Well Wisher said: (Thu, Feb 10, 2011 12:48:46 AM)    
 
Kumar is correct.

Varun said: (Mon, Apr 4, 2011 09:00:47 AM)    
 
What should be added here (in this case) to make output correct.

Devendra said: (Sat, Aug 20, 2011 05:00:59 PM)    
 
If we use stdio.h,ans. is -.000901 and using math.h ans is -.001263

Why is it different?

Hajmaldeen said: (Tue, Dec 20, 2011 10:40:34 AM)    
 
How to run this program to unix?

Write your comments here:
Name *:     Email:


© 2008-2011 by IndiaBIX™ Technologies. All Rights Reserved | Copyright | Terms of Use & Privacy Policy

Advertise     Contact us: info@indiabix.com     Follow us on twitter!