Nt1310 Unit 6 Ilab

1857 Words8 Pages

#include
#include
int main()
{
float x,y,res; printf ("Enter the value X & Y\n" ); scanf("%f%f", &x, &y); res = pow(x,y); printf ("X to the power of Y = %.2f\n", res); return 0;
}
Output:
Enter the value X & Y
5
4
X to the power of Y = 625.00
Explanation: The math.h is utilized to compute the area of triangle. Similarly, other mathematical operations can be performed using the math.h header file.
Some of the commonly used header files supported in C program are mentioned in the below Table 5.2.1.
Header file Description

Helps in some mathematical operations. Helps to call the input and output statements. Helps to call some standard library files. Helps in string computations. Defines the time for computations Helps in character …show more content…

wchar_t This is the type of integer and it is the size of a character wide constant. div_t This will be the structure that can be returned by div function. ldiv_t This will be the structure that can be returned by the ldiv function.
Table 5.2.2: stdlib.h variables
The macros supported by stdlib.h are shown in below Table 5.2.3:
Macro Description
NULL This is a type of macro which has the value of a null pointer constant.
EXIT_FAILURE This is treated as a value of the exit function which used to indicate the state of failure.
EXIT_SUCCESS This is treated as the value of the exit function which will be used to return value in case of success.
RAND_MAX This is a type of macro which indicates the maximum value returned by the rand function.
MB_CUR_MA This is a type of macro which indicates the maximum number of bytes in a multi-byte character set that cannot be larger than MB_LEN_MAX.
Table 5.2.3: stdlib.h Macros
Several functions supported by stdlib.h include:
Function Description double atof(const char *str)
This function will convert the string, which is referred by the argument str to a floating-point number (of the type …show more content…

Macro Description
HUGE_VAL It is used as a result of the function and cannot be represent as a floating point number. However if the magnitude of the result is quite large then the function will be set to errno to ERANGE value in order to indicate a range error. It will returns a very large value and named as macro HUGE_VAL or its negation (- HUGE_VAL).
Also, if the magnitude of the result is too small then a value of zero will be returned instead. In this scenario, errno will not be set to ERANGE.
Table 5.2.9: math.h Macro
Several functions which are supported by math.h:
Function Description double acos (double x)
It will return the arc cosine of x in terms of radians. double asin (double x)
It will return the arc sine of x in terms of radians. double atan (double x)
It will return the arc tangent of x in terms of radians. double atan2 (doubly y, double x)
It will return the arc tangent in terms of radians of y/x based on the signs of both values to determine the correct quadrant. double cos (double x)
It will return the cosine of a radian angle x. double cosh (double x)
It will return the hyperbolic cosine of