Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Cos
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Console.Write("Введите X:");
  14. double x = double.Parse(Console.ReadLine());
  15. double sum = 0.0;
  16. Console.Write("Введите N:");
  17. int N = int.Parse(Console.ReadLine());
  18. double Q = 1.0;
  19. for (int n = 1; n < N; n++)
  20. {
  21. sum += Q;
  22. Q*= -x/ (2 * n);
  23. Console.Write("n={0}\t, Q={1}\t,Cумма={2}\t \n", n, Q, sum.ToString());
  24. }
  25. Console.WriteLine("Сумма={0}", sum.ToString());
  26. Console.WriteLine("Cos(-x)={0}\t", Math.Cos(-x));
  27. Console.ReadKey();
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement