Write a C Program by using sqrt() , sin() , cos() and tan() Functions

Engg.... | 00:26 | | Best Blogger Tips
Mathematical Functions
Mathematical Functions:
  1. C provides a large number of Library Functions which perform specific operations. 
  2. Mathematical functions are also included among these Library Functions. 
  3. 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<stdio.h>
#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


Please Share it! :)
Do you like this Story?

Get Free Email Updates Daily!

Follow us!

0 comments:

Post a Comment