Untitled
unknown
csharp
a year ago
1.0 kB
8
Indexable
using System; namespace Program { class Program { static void Main(string[] args) { Console.Write("Введите X: "); double X = double.Parse(Console.ReadLine()); Console.Write("Введите Y: "); double Y = double.Parse(Console.ReadLine()); Console.Write("Введите N: "); double N = double.Parse(Console.ReadLine()); double result = 0; for (int i = 0; i < N; i++) { if (i % 2 == 0) { double term = Math.Pow(X - Y, 2 * i) / ((2 * i + 1) * (2 * i + 3) * 1); result += term; } else { double term = Math.Pow(X - Y, 2 * i) / ((2 * i + 1) * (2 * i + 3) * -1); result += term; } } Console.WriteLine($"Результат: {Math.Round(result, 2)}"); } } }
Editor is loading...
Leave a Comment