Please use C Programing Calculating the value of n from the

Please use C Programing.

Calculating the value of n from the sum of the following series pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ... Write a program that asks the user to enter number of terms and find the value of pi approximated by that number of terms.

Solution

#include int main() {     int i;     int count = 0;     double pi = 4.0; for ( i = 3; i <= 1000; i += 2) {         if ( count % 2 == 0 ) {         pi -= 4.0 / (double)i;         printf( \"%0.2f\\t\", pi);         }         else {         pi += 4.0 / (double)i;         printf( \"%0.2f\\t\", pi);         }         count++; }     return 0; }
Please use C Programing. Calculating the value of n from the sum of the following series pi = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 + ... Write a program that asks t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site