function in C

Sine function in C programming Language

Sine function in C programming Language

In this tutorial, we will discuss Sine function in C programming Language

Sine function in C

Description

Description of  the C programming Language  Sin() function

In C programming language the sine function returns the sine of the radian angle x.

sin(): In the C programming Language this is used to calculate sine value to given radians.

Declaration

The Declaration of the sin() function

double sin(double x);

Parameter or Arguments

the parameter of the sine function is:

x – This is the floating point value of an angle and always measured in radians(not degrees).

Returns

The sin() returns the sine of x, measured in radians.

Required header

In the C language, the required header of the sin() function  in C

#include <math.h>

Example – Sin() in C programming

The following example shows the usage of sin() function

Program for Sine function in C

Program 1

#include <stdio.h>
#include <math.h>

int main()
{
    double x=0.5,y=1;//define and initiates variables

    printf("sine value of %f is %f\n",x,sin(x));
    printf("sine value of %f is %f\n",y,sin(y));
    getch();
    return 0;
}

 

When compile and run above program, this will produce the following result

sine value of 0.500000 is: 0.479426
sine value of 1.000000 is: 0.841471

Program 2

#include <stdio.h>
#include <math.h>
//sin calculator in C
int main()
{     //define variables
    float sineValue,inputValue;
        //Get input from user
    printf("please enter the value to calculate sine: ");
    scanf("%f",&inputValue);
        //Calculate the sine value 
    sineValue=sin(inputValue);
         //Display the sine value
    printf("\nThe sine value of %f is =%f",inputValue,sineValue);
    getch();
    return 0;
}

When compile and run above program, this will produce the following result

please enter the value to calculate sine: 2.56

The sine value of 2.560000 is  =0.549356

 

 

Similar Functions

Other C programming language functions that are  similar to the cosine function      

cosh function   in C  language                               

sinh function in C language

tanh function in C language

abs function in C language

floor function in C language

ceil function in C language

round function in C language

sqrt function in C language

pow function in C language

exp function in C language

log function in C language

log10 function in C language

trunc function in C language

 

 

suggested for you

Function in C language

User defined function in C language

Arithmetic functions in C Language

String function in C language

 

cos function in C programming language
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

PHP Star Triangle pattern program

PHP Star Triangle pattern program In this tutorial, we will discuss about PHP Star Triangle…

6 months ago

PHP Full Pyramid pattern program

PHP Full Pyramid pattern program In this tutorial, we will discuss about PHP Full Pyramid…

6 months ago

5 methods to add two numbers in Java

5 methods to add two numbers in Java In this tutorial, we will discuss the…

6 months ago

Python Full Pyramid star pattern program

Python full Pyramid star pattern program In this tutorial, we will discuss  the concept of…

9 months ago

Write a function or method to convert C into F -Entered by user

Write a function or method to convert C into F -Entered by the user In…

1 year ago

How to write a function or method to convert Celsius into Fahrenheit

How to write a function or method to convert Celsius into Fahrenheit In this tutorial,…

1 year ago