Write a program to display the sum of the following series.
2/1! + 4/3! + 6/5! + 8/7! + 10/9! + . . . + n/(n-1)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Problem26
{
classProblem26
{
staticvoid Main(string[] args)
{
int num;
double fact1 = 1;
double temp;
double sum = 0;
Console.WriteLine("Enter Number To Display The Sum Of The Following Series i.e. sum of the factorial of series\n Like This 2/1! + 4/3! + 6/5! + 8/7! + 10/9! + . . . +
n/(n-1)!");
num = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= num; i++)
{
if (i % 2 != 0)
{
fact1 = 1;
for (int j = 1; j <= i; j++)
{
fact1 = fact1 * j;
}
}
if (i % 2 == 0)
{
temp = i / fact1;
sum = sum + temp;
}
}
Console.WriteLine("\nThe Sum Of The Following Series: " + sum);
Console.ReadKey();
}
}
}
Output: