This blog is under construction

Sunday 29 April 2012

asin example in C

Header file:
    math.h

Synopsis:
     double asin(double x);

Description:
     Returns principal value of the arc sine of x.


asin function in C example:


  #include<stdio.h>
  #include<math.h>
  int main() {
        /*
         * radian to degree conversion
         * degree = radian * 180 / PI;
         */
        double deg, radian;
        printf("Enter your input:");
        scanf("%lf", &radian);
        deg = asin(radian) * (180 / 3.14);
        printf("Degree: %lf\n", deg);
        return 0;
  }




  Output:
  jp@jp-VirtualBox:~/cpgms/math$ gcc asin.c -lm
  jp@jp-VirtualBox:~/cpgms/math$ ./a.out
  Enter your input:1
  Degree: 90.045649


No comments:

Post a Comment