C++ Math sin()

Last Updated : 18 May 2026

Math sin() Function

In C++, the sin() function is defined in the <cmath> or <math.h> header file and is used to calculate the sine of an angle specified in radians. The sine value represents the vertical coordinate of a point on the unit circle corresponding to the given angle.

The sin() function accepts positive, negative, and zero values as input and returns a value in the range from -1 to 1. It is widely used in trigonometry, physics, graphics programming, and mathematical calculations.

Syntax

It has the following syntax.

Note: If the value passed is an integer type, then it is cast to double.

Parameters

x: The value specified in terms of radian.

Return value

It returns the sine of an angle given in radian in the range[-1,1].

Examples of Math sin() Function

Here, we are going to discuss several examples to demonstrate the Math sin() Function

Example 1: Find the Sine of a Positive Angle Using sin()

This example demonstrates how to calculate the sine of a positive angle by converting degrees into radians and using the sin() function.

Output:

Sine of an angle is : 0.86576   

Explanation:

In this example, sin() function calculates the sine of an angle when the degree is equal to 60.

Example 2: Find the Sine of a Negative Angle Using sin()

This example demonstrates how the sin() function calculates the sine of a negative angle. The returned value is also negative when the angle is negative.

Output:

Sine of an angle is : -0.76576 

Explanation:

In his example, sin() function finds the sine of an angle when the value of degree is negative i.e -50.

Example 3: Find the Sine of Zero Using sin()

This example demonstrates how to calculate the sine of zero radians using the sin() function. The sine of zero is always equal to 0.

Output:

Sine of an angle is : 0