{"id":98,"date":"2020-06-29T10:51:31","date_gmt":"2020-06-29T10:51:31","guid":{"rendered":"\/?p=98"},"modified":"2020-06-29T16:30:59","modified_gmt":"2020-06-29T16:30:59","slug":"cosine-series-sinx1-x2-2x4-4-x6-6","status":"publish","type":"post","link":"http:\/\/suryaprakash.com.np\/?p=98","title":{"rendered":"Cosine Series (\u00a0cos(x)=1-x^2\/2!+x^4\/4!-x^6\/6!+&#8230;&#8230;&#8230;&#8230;&#8230;)"},"content":{"rendered":"<p>\/\/c program to find the value of cosine series<br \/>\n#include&lt;stdio.h&gt;<br \/>\n#define pi 3.1416<br \/>\nvoid main()<br \/>\n{<br \/>\nint n,i;<br \/>\nfloat x, sum=0;<br \/>\nprintf(&#8220;enter the value of angle in degree\\n&#8221;);<br \/>\nscanf(&#8220;%f&#8221;,&amp;x);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ x in degree<br \/>\nprintf(&#8220;enter the value of n:&#8221;);<br \/>\nscanf(&#8220;%d&#8221;,&amp;n);<br \/>\nx= pi*x\/180;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\/\/ x in radian<br \/>\nfloat t1=1;<br \/>\nfor(i=0;i&lt;=n;i++)<br \/>\n{<br \/>\nsum+=t1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ logic for sin(x)=1-x^2\/2!+x^4\/4!-x^6\/6!+&#8230;&#8230;&#8230;&#8230;&#8230;<br \/>\nt1= t1*(-x*x)\/((2*i+1)*(2*i+2));<br \/>\n}<br \/>\nprintf(&#8220;Cos(x)=%f&#8221;,sum);<br \/>\n}<\/p>\n<p><strong>OUTPUT<\/strong><\/p>\n<p><img loading=\"lazy\" class=\"alignnone size-medium wp-image-99\" src=\"\/wp-content\/uploads\/2020\/06\/cosine-300x133.png\" alt=\"\" width=\"300\" height=\"133\" srcset=\"\/wp-content\/uploads\/2020\/06\/cosine-300x133.png 300w, \/wp-content\/uploads\/2020\/06\/cosine.png 497w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>Accuracy depends upon the value of n.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/\/c program to find the value of cosine series #include&lt;stdio.h&gt; #define pi 3.1416 void main() { int n,i; float x, &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/98"}],"collection":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=98"}],"version-history":[{"count":2,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions"}],"predecessor-version":[{"id":101,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=\/wp\/v2\/posts\/98\/revisions\/101"}],"wp:attachment":[{"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/suryaprakash.com.np\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}