math.h Header File in C Programming

math.h is a header file which is commonly used for mathematical operations. Some functions of this header file uses floating point numbers. The functions which accepts angle are accepted in terms of radians.

Some of the standard member functions of math.h header files are,

__________________________________________________________
Function Name	Description
__________________________________________________________

acos -		Arccosine - Returns inverse cosine.
cos -		Returns cosine.
log -		Returns log of a number.
pow(x,y) -	Returns power of x raise to y. i.e. xy
sqrt -		Returns square root of a number.
tan -		Returns tangent.
ceil -		Ceiling - Small int not less than that of 
		parameter.
exp -		Uses as an Exponential function.
floor -		Floor - Largest int not greater than parameter.
__________________________________________________________

Program :

/*  Program to demonstrate math.h header file working.
Creation Date : 06 Nov 2010 03:36:27 PM
Author : www.technoexam.com [Technowell, Sangli] */

#include <stdio.h>
#include <conio.h>
#include <math.h>

int main(void)
{
	clrscr();
	printf("\n\t Log of 10 : %f",log(10));
	printf("\n\n\t Square Root of 16 : %f",sqrt(16));
	printf("\n\n\t Square of 4 : %f",pow(4,2));
	printf("\n\n\t Sine of 10 : %f",sin(10));
	getch();
	return 0;
}

Output :

	Log of 10 : 2.302585

	Square Root of 16 : 4.000000

	Square of 4 : 16.000000

	Sine of 10 : -0.544021_

Leave A Comment

Your email address will not be published. Required fields are marked *