Untitled
unknown
csharp
a year ago
1.1 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 = 1.0; int s = 1; for (int i = 1; i <= N; i++) { double term = 0.0; double f = 1.0; for (int j = 1; j <= 2 * i - 1; j++) { f *= j; } if (i % 2 == 1) term = (Math.Pow(X, i) - Math.Pow(Math.Cos(Y), i)) / f; else term = (Math.Pow(Y, i) + Math.Pow(Math.Cos(X), i)) / f; result += s * term; s *= -1; } Console.WriteLine($"Результат: {Math.Round(result, 2)}"); } } }
Editor is loading...
Leave a Comment