[Plain] # include <stdio. h>
# Include <stdlib. h>
# Include <math. h>
# Define PI 3.1415926
Int factorial (int num );
Double COS (double x );
Double SIN (double x );
Int main ()
{
Double x;
Printf ("Please enter the Angle:"); // the Angle required by the input
Scanf ("% lf", & x );
Printf ("sin (x * PI/180) = % lf \ n", SIN (x * PI/180 ));
Printf ("cos (x * PI/180) = % lf \ n", COS (x * PI/180 ));
System ("PAUSE ");
Return 0;
}
// The definition of the function
// ** Factorial function
Int factorial (int num)
{
Int sum;
Sum = 0;
If (num = 0 | num = 1)
{
Sum = 1;
}
Else
{
Sum = num * factorial (num-1 );
}
Return sum;
}
// ** Sin () function
Double SIN (double x)
{
Int I;
Int k;
Double sum;
K = 1;
Sums = 0.0;
For (I = 1; pow (x, I)/factorial (I)> 0.0000001; I + = 2)
{
Sum + = k * pow (x, I)/factorial (I );
K =-1 * k;
}
Return sum;
}
// ** Cos () function
Double COS (double x)
{
Int I;
Int k;
Double sum;
K = 1;
Sums = 0.0;
For (I = 0; pow (x, I)/factorial (I)> 0.0000001; I + = 2)
{
Sum + = k * pow (x, I)/factorial (I );
K =-1 * k;
}
Return sum;
}
# Include <stdio. h>
# Include <stdlib. h>
# Include <math. h>
# Define PI 3.1415926
Int factorial (int num );
Double COS (double x );
Double SIN (double x );
Int main ()
{
Double x;
Printf ("Please enter the Angle:"); // the Angle required by the input
Scanf ("% lf", & x );
Printf ("sin (x * PI/180) = % lf \ n", SIN (x * PI/180 ));
Printf ("cos (x * PI/180) = % lf \ n", COS (x * PI/180 ));
System ("PAUSE ");
Return 0;
}
// The definition of the function
// ** Factorial function
Int factorial (int num)
{
Int sum;
Sum = 0;
If (num = 0 | num = 1)
{
Sum = 1;
}
Else
{
Sum = num * factorial (num-1 );
}
Return sum;
}
// ** Sin () function
Double SIN (double x)
{
Int I;
Int k;
Double sum;
K = 1;
Sums = 0.0;
For (I = 1; pow (x, I)/factorial (I)> 0.0000001; I + = 2)
{
Sum + = k * pow (x, I)/factorial (I );
K =-1 * k;
}
Return sum;
}
// ** Cos () function
Double COS (double x)
{
Int I;
Int k;
Double sum;
K = 1;
Sums = 0.0;
For (I = 0; pow (x, I)/factorial (I)> 0.0000001; I + = 2)
{
Sum + = k * pow (x, I)/factorial (I );
K =-1 * k;
}
Return sum;
}