Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs

SIN Function in C

by suresh

The C sin Function is a C Math Library Function, used to calculate the Trigonometry Sine value for the specified expression. The syntax of the sin in C Programming is

double sin(double number);

The SIN function in C will return the value between -1 and 1. Before we get into the syntax of a SIN function in C, Let us see the mathematical formula behind this Trigonometry Sine function:

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, ask 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 C ASIN Function article to calculate the Arc Sine of a specified expression.

/* Example for SIN Function in C Programming */

#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;
}
SIN Function in C programming 1

C SINE Function Example 2

This C Programming example allow the user to enter the value in degrees, and then we are converting the degrees to Radians. And finally, we are finding the sine value of the radian

/* Example for SIN Function in C Programming */

#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", &degreeVal);
  
  // Convert Degree Value to Radian 
  radianVal = degreeVal * (PI/180);
  sinValue = sin(radianVal);
  
  printf("\n The Sine value of %f = %f ", degreeVal, sinValue);
  
  return 0;
}
SIN Function in C programming 2

Placed Under: C Programming

  • C Comments
  • C Escape Sequence
  • C Programming Operators
  • C Arithmetic Operators
  • C Assignment Operators
  • C Bitwise Operators
  • C Conditional Operator
  • C Increment & Decrement Optr
  • C Logical Operators
  • C Relational Operators
  • C Sizeof Operator
  • C If Statement
  • C IF ELSE Statement
  • C Else If Statement
  • C Nested If
  • C Break Statement
  • C Continue Statement
  • C Goto Statement
  • C Switch Case
  • C For Loop
  • C While Loop
  • C Do While Loop
  • C Arrays
  • C Two Dimensional Array
  • C Multi Dimensional Array
  • C String
  • C Structures
  • C Nested Structures
  • C Array of Structures
  • C Structures and Functions
  • C Union
  • C Structure & Union differences
  • C Pointers
  • C Pass Pointers to Functions
  • C GETS
  • C fgets Function
  • C fgetc
  • C fputs function
  • C fputc
  • C Functions
  • C Types of Functions
  • C Pass Array to Functions
  • Call By Value & Call By Reference
  • C Recursion
  • C Program Examples

Copyright © 2021ยท All Rights Reserved.
About | Contact | Privacy Policy