Your AD CODE HERE

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C program for cosine Series
12-10-2011, 03:31 AM
Post: #1
Your Google Ad Here
C program for cosine Series
Code C :
 
#include
#include
#include
#include
 
void main()
{
int n, x1;
float acc, term, den, x, cosx=0, cosval;
 
clrscr();
 
{FNAMEL}.html">printf("Enter the value of x (in degrees)\n");
scanf("%f",&x);
 
x1 = x;
 
/* Converting degrees to radians*/
 
x = x*(3.142/180.0);
cosval = cos(x);
 
{FNAMEL}.html">printf("Enter the accuary for the result\n");
scanf("%f", &acc);
term = 1;
cosx = term;
n = 1;
 
do
{
den = 2*n*(2*n-1);
term = -term * x * x / den;
cosx = cosx + term;
n = n + 1;
} while(acc <= fabs(cosval - cosx));
 
{FNAMEL}.html">printf("Sum of the cosine series = %f\n", cosx);
{FNAMEL}.html">printf("Using Library function cos(%d) = %f\n", x1,cos(x));
}
 

Find all posts by this user
Quote this message in a reply
   

Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  C program to find and output all the roots of a quadratic equation, for non-zero coef expert.here 1 1,223 05-02-2012 09:25 PM
Last Post: swethauday
  Simple C program to create a linked list and display list elements expert.here 0 1,164 12-12-2011 02:09 AM
Last Post: expert.here
  C program to store employee records in a file expert.here 0 758 12-12-2011 02:07 AM
Last Post: expert.here
  C program to find the sum of 2 dimensional array using dynamic mem allocation expert.here 0 494 12-12-2011 02:04 AM
Last Post: expert.here
  C program to find if a matrix is sparse or not expert.here 0 542 12-12-2011 02:01 AM
Last Post: expert.here
  C program t find the trace and normal of a matrix expert.here 0 698 12-12-2011 02:00 AM
Last Post: expert.here
  C program to calculate the sum of rows and columns of Matrixsum of expert.here 0 1,852 12-12-2011 01:58 AM
Last Post: expert.here
  C program to find the sum of all digits present in a String expert.here 0 1,114 12-12-2011 01:55 AM
Last Post: expert.here
  C program to find the quadrant from x-y coordinates expert.here 0 1,142 12-12-2011 01:53 AM
Last Post: expert.here
  C program Exchange main diagonal elements of the matrix with 2nd diagonal elements expert.here 0 548 12-12-2011 01:51 AM
Last Post: expert.here

Forum Jump:


User(s) browsing this thread: 1 Guest(s)