Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- Console.Write("Въведете x: ");
- double x = double.Parse(Console.ReadLine());
- double eps;
- do
- {
- Console.Write("Въведете eps (напр. 0.0001): ");
- eps = double.Parse(Console.ReadLine());
- } while (eps <= 0 || eps >= 1);
- double term = x; // първи член: x
- double sum = term; // натрупана сума
- int n = 0;
- while (Math.Abs(term) >= eps)
- {
- n++;
- term *= -1 * x * x / ((2 * n) * (2 * n + 1));
- sum += term;
- }
- Console.WriteLine($"Резултат y = {sum}");
- Console.WriteLine($"Контролна стойност Math.Sin(x) = {Math.Sin(x)}");
- }
- }
Add Comment
Please, Sign In to add comment