Computer Science, asked by chythrashivaram, 9 months ago


enter n values,
write a c
programming code
determine the total form the
Following operations
Tot = (1^2/2^3) + (3^2/4^3) + (5^2/6^3) + ( 6^2/7^3)+......+
(n-1) ^2
(n+1)^3

Answers

Answered by Anonymous
1

Answer:

// C++ program to find the sum of

// the given series

#include <stdio.h>

#include <math.h>

#include <iostream>

using namespace std;

// Function to return the

// sum of the series

float getSum(int a, int n)

{

// variable to store the answer

float sum = 0;

for (int i = 1; i <= n; ++i)

{

// Math.pow(x, y) returns x^y

sum += (i / pow(a, i));

}

return sum;

}

// Driver code

int main()

{

int a = 3, n = 3;

// Print the sum of the series

cout << (getSum(a, n));

return 0;

}

Similar questions