Arithmetical Library Function In C
C function where are
used to perform mathematical operations
program are called arithmetical function.
This library are inbuilt in arithmetical function in c language.
“math.h” and “stdlib.h”
header files support all the arithmetical function in c language.
List
of arithmetical function given below:
1.pow()
2.sin()
3.sqrt()
4.log()
Fig: arithmetical library in c |
1.pow()
This is used to find
power of given number.
Program
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,n,j;
printf(“Input two
number”);
scanf(“%d %d%d”,
&I,&j,&n);
n=pow(I,j);
printf(n);
getch();
}
Output:
Input two value
5
3
125
2.sin()
This function is used
to calculate sine value.
Program
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,n;
printf(“Input number”);
scanf(“%d %d%d”,
&I);
n=pow(I);
printf(n);
getch();
}
Output:
Input value
90
0
3.sqrt()
This f unction is used to find the square root of the argument passed to this function.Program
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int i,n;
printf(“Input number”);
scanf(“%d %d%d”,
&I);
n=sqrt(I);
printf(n);
getch();
}
Output:
Input value
25
5
4.log()
This function is used
to calculate the natural logarithm.
Program
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
double n,x;
x=72.325;
n=log(x);
printf(n);
printf(x);
getch();
}
Ouput:
72.325
4.28117
No comments:
Post a Comment