Mathematical Functions:
#include<stdio.h>
- C provides a large number of Library Functions which perform specific operations.
- Mathematical functions are also included among these Library Functions.
- C Mathematical Functions are defined in the Header File math.h.
Statement of C Program: This Program illustrates the use of sqrt() , sin() , cos() and tan() Functions:
#include<conio.h>
#include<math.h>
main()
{
float a , b , sq , sinx , cosx , tanx;
clrscr();
x = 4; /* Initialise */
y=30;
sq = sqrt(x);
y = 30*(3.142/180); /* Convert to Radian */
sinx=sin(y);
cosx=cos(y);
tanx=tan(y);
printf("Square root of x = %f\n" , sq);
printf("Sine value of y = %f\n" , sinx);
printf("Cosine value of y = %f\n" , cosx);
printf("Tangent value of y = %f\n" , tanx);
getch();
}
Output:
Square root of x = 2
Sine value of y = 0.500059
Cosine value of y = 0.865991
Tangent value of y = 0.577441
0 Response to "Write a C Program by using sqrt() , sin() , cos() and tan() Functions"
Post a Comment