The C sin Function is a Math Library Function used to calculate the Trigonometry Sine value for the specified expression. The syntax of the SIN function is as shown below.
double sin(double number);
The SIN function will return a value between -1 and 1. Before we get into the syntax of a SIN function, Let us see the mathematical formula behind this Trigonometry Sine:
sin(x) = Length of the Opposite Side / Length of the Hypotenuse
SIN Function in C Example
The sin function in the math library allows you to calculate the trigonometric Sine for the specified values. This program asks the user to enter his/her own value. And then it will find the sine value of the user-specified value.
TIP: Please refer to the ASIN Function and math articles to calculate the Arc Sine of a specified expression.
#include <stdio.h>
#include <math.h>
int main()
{
double sinValue, number;
printf(" Please Enter the Value to calculate Sine : ");
scanf("%lf", &number);
sinValue = sin(number);
printf("\n The Sine value of %lf = %f ", number, sinValue);
return 0;
}

SINE Function Example 2
This C Programming example allows the user to enter the value in degrees, and then we convert the degrees to Radians. And finally, we are finding the sine value of the radian.
#include <stdio.h>
#include <math.h>
#define PI 3.14159
int main()
{
double sinValue, radianVal, degreeVal;
printf(" Please Enter an Angle in degrees : ");
scanf("%lf", °reeVal);
// Convert Degree Value to Radian
radianVal = degreeVal * (PI/180);
sinValue = sin(radianVal);
printf("\n The Sine value of %f = %f ", degreeVal, sinValue);
return 0;
}
Please Enter an Angle in degrees : 30
The Sine value of 30.000000 = 0.500000