Forum Replies Created
Viewing 1 post (of 1 total)
- AuthorPosts
- RandiHoltermannParticipant
Thanks for your input. The following is the working scripts
12345678910111213141516171819202122#include <stdio.h><br />int main (void)<br />{<br />int x;<br />float sum=0;<br />double PI;<br /><br />printf("Please enter the terms of series that should be included> ");<br />scanf("%d", &x);<br /><br />for (int i=1; i<x; i+=2)<br />if (i%4==1)<br />sum=sum+1./(double)i;<br />else<br />sum=sum-1./(double)i;<br /><br />PI= 4*sum;<br />printf("The sum is %fn", sum);<br />printf("Approximate value of PI is %fn", PI);<br /><br />return 0;<br />} - AuthorPosts
Viewing 1 post (of 1 total)