A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

C program to find sum of following series
Q:

C program to find sum of following series

0

C program to find sum of following series:
1 + 3^2/3^3 + 5^2/5^3 + 7^2/7^3 + ... till N terms

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

/*  
C program to find sum of following series
 1 + 3^2/3^3 + 5^2/5^3 + 7^2/7^3 + ... till N terms
*/

#include<stdio.h>
#include<math.h>
    
int main()
{
	int i,N;
	float sum;
	int count;
	
	
	/*read value of N*/
	printf("Enter total number of terms: ");
	scanf("%d",&N);
	
	/*set sum by 0*/
	sum=0.0f;
	
	/*calculate sum of the series*/
	count=1;
	for(i=1;i<=N;i++)
	{
		sum = sum +  ( (float)(pow(count,2)) / (float)(pow(count,3)) );
		count+=2;
	}
	
	/*print the sum*/
	
	printf("Sum of the series is: %f\n",sum);
	
	return 0;
}
Enter total number of terms: 10
Sum of the series is: 2.133256

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now