Computer Science, asked by birajsahakol, 4 months ago

wap in nested loop:-S = 1 + (x^2/2) + (x^3/3) + (x^4/4) + ………..(x^n/n)​

Answers

Answered by raghulragavi07
0

Explanation:

Program to get the Sum of series: 1 – x^2/2! + x^4/4! -…. upto nth term

This is a mathematical series program where a user must enter the number of terms up to which the sum of the series is to be found. Following this, we also need the value of x, which forms the base of the series.

Examples:

Input : x = 9, n = 10

Output : -5.1463

Input : x = 5, n = 15

Output : 0.2837

Recommended: Please try your approach on {IDE} first, before moving on to the solution.

Simple approach :

We use two nested loops to compute factorial and use power function to compute power.

// C program to get the sum of the series

#include <math.h>

#include <stdio.h>

// Function to get the series

double Series(double x, int n)

{

double sum = 1, term = 1, fct, j, y = 2, m;

Similar questions