C Program to Use Trigonometric Functions

C programming, you can use trigonometric functions from the <math.h> header to perform various trigonometric calculations. Here’s a simple program that demonstrates the use of some common trigonometric functions.

sin( ) :

#include<stdio.h>
#include<math.h>
int main()
{
double result,x;
printf(“Enter the Value : “);
scanf(“%lf”,&x);
result=sin(x);
printf(“The sin() of %lf is %lf\n”,x,result);
return 0;
}

Output :

cos( ) :

#include<stdio.h>
#include<math.h>
int main()
{
double result,x;
printf(“Enter the Value : “);
scanf(“%lf”,&x);
result=cos(x);
printf(“The cosine() of %lf is %lf\n”,x,result);
return 0;
}

Output :

tan( ) :

#include<stdio.h>
#include<math.h>
int main()
{
double result,x;
printf(“Enter the Value : “);
scanf(“%lf”,&x);
result=tan(x);
printf(“The tan of %lf is %lf\n”,x,result);
return 0;
}

Output :

abs( ) :

#include<stdio.h>
#include<math.h>
int main()
{
int result,x;
printf(“Enter the Value : “);
scanf(“%d”,&x);
result=abs(x);
printf(“The Absolute value of %d is %d\n”,x,result);
return 0;
}

Output :

sqrt( ) :

#include<stdio.h>
#include<math.h>
int main()
{
double result,x;
printf(“Enter the Value : “);
scanf(“%lf”,&x);
result=sqrt(x);
printf(“The square root of %lf is %lf.\n”,x,result);
return 0;
}

Output :

log( ) :

#include<stdio.h>
#include<math.h>
int main()
{
double result,x;
printf(“Enter the Value : “);
scanf(“%lf”,&x);
result=log(x);
printf(“The natural log of %lf is %lf.\n”,x,result);
return 0;
}

Output :

Leave a Comment

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

Shopping Basket
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare
Verified by MonsterInsights