#include <stdio.h> #include<math.h> int main (){ int n,x1,i,j; float x,sign,cosx,fact; printf("Enter The Number Of Terms In Aseries :\n"); scanf("%d",&n); printf("Enter The Value Of x (In degrees)\n"); scanf("%f",&x); x1=x; x=x*(3.142/180.0); /* convert to degree */ cosx=1; sign=-1; for(i=2;i<=2;i=i+2){ fact=1; for(j=1;j<=i;j++){ fact=fact*j; } cosx=cosx+(pow(x,i)/fact)*sign; sign=sign*(-1); } printf("Sum of the cosine series = %f\n",cosx); printf("The Value of cos(%d) using library function=%f\n",x1,cos(x)); return 0; }
Most Popular
-
Befunge: Developed by : Chris Pressey Year: 1993 Stack-based, reflective, esoteric programming language.
-
-
The list below is an unordered list. You can pick any book you like, and some of the books don’t even cover a programming language at all,...
-
Recursion happens when function calls itself directly or indirectly.
Copyrights © 2016 Codzya. Powered by Blogger.
Sunday, May 1, 2016
Subscribe to:
Post Comments (Atom)
Recent
Weekly
-
Befunge: Developed by : Chris Pressey Year: 1993 Stack-based, reflective, esoteric programming language.
-
-
The list below is an unordered list. You can pick any book you like, and some of the books don’t even cover a programming language at all,...
-
Recursion happens when function calls itself directly or indirectly.
-
1- The C Programming Language This book is a comprehensive guide to the finalized ANSI standard C language programming. It has b...
Comment
Get this Recent Comments Widget
!->
0 Comment to "Sum of Cos(x) Series"
Post a Comment