> Online tutorial

atan() in c

atan Arc cosine, arc sine, and arc tangent functions
Declaration:
Real:
double atan(double x);
double atan2(double y, double x);
Remarks:
atan and atanl calculate the arc tangent of the input value
atan2 and atan2l also calculate the arc tangent of the input value
Return Value:
atan and atanl return the arc tangent of the input value (in the range -pi/2 to pi/2)
atan2 and atan2l return the arc tangent of y/x (in the range -pi to pi).

Program



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

int main(void)
{
   double result;
   double x = 0.5;

   result = atan(x);
   printf("The arc tangent of %lf is %lf\n", x, result);
   return(0);
}


asin

 Arc cosine, arc sine, and arc tangent functions

 Declaration:
 Real:                   
              double atan(double x);
              double atan2(double y, double x);


Remarks:

                     atan and atanl calculate the arc tangent of the input value
                    atan2 and atan2l also calculate the arc tangent of the input value

Return Value:

   atan and atanl return the arc tangent of the   input value (in the range -pi/2 to pi/2)
   atan2 and atan2l return the arc tangent of y/x      (in the range -pi to pi).

Program

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

int main(void)
{
   double result;
   double x = 0.5;

   result = atan(x);
   printf("The arc tangent of %lf is %lf\n", x, result);
   return(0);
}


asin

 Arc cosine, arc sine, and arc tangent functions

 Declaration:
 Real:               
                                double asin(double x);
                                long double asinl(long double (x));

Remarks:

                  asin and asinl of a real value compute the arc sine of that value

Return Value:

   asin and asinl return the arc sine of the input value (in the range -pi/2 to pi/2)

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

int main(void)
{
   double result;
   double x = 0.5;

   result = asin(x);
   printf("The arc sin of %lf is %lf\n", x, result);
   return(0);
}


 acos

 Arc cosine, arc sine, and arc tangent functions

 Declaration:
 Real:   
            double acos(double x);
long double acosl(long double (x));
complex acos(complex z);

Remarks:

                acos and acosl of a real value compute the arc cosine of that value

Return Value:

   On success,
   acos and acosl return the arc cosine of the input value (in the range 0 to pi)

Program

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

int main(void)
{
  double result;
  double x = 0.5;

  result = acos(x);
  printf("The arc cosine of %lf is %lf\n", x, result);
  return 0;
}

 struct (keyword)

 Groups variables into a single record

 Syntax:

  struct [<struct type name>] {
    [<type> <variable-name[, variable-name, ...]>] ;
    [<type> <variable-name[, variable-name, ...]>] ;
    ...
  } [<structure variables>] ;

A struct, like a union, groups variables into a single record.
             


Though both <struct type name> and <structure variables> are optional, one
of the two must appear.

Elements in the record are defined by naming a <type>, followed by one or
more <variable-name> (separated by commas).

Different variable types can be separated by a semicolon.

 Example:

  struct my_struct {
    char name[80], phone_number[80];
    int  age, height;
  } my_friend;

This struct declares an array of records containing two strings (name and
phone_number) and two integers (age and height).

To access elements in a structure, you use a record selector (.). For
example,

  strcpy(my_friend.name,"Mr. Wizard");