Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Cos
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Введите X:");
- double x = double.Parse(Console.ReadLine());
- double sum = 0.0;
- Console.Write("Введите N:");
- int N = int.Parse(Console.ReadLine());
- double Q = 1.0;
- for (int n = 1; n < N; n++)
- {
- sum += Q;
- Q*= -x/ (2 * n);
- Console.Write("n={0}\t, Q={1}\t,Cумма={2}\t \n", n, Q, sum.ToString());
- }
- Console.WriteLine("Сумма={0}", sum.ToString());
- Console.WriteLine("Cos(-x)={0}\t", Math.Cos(-x));
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement