Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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.  
  8. namespace ConsoleApplication1
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int i;
  15. double s = 0.0, sn;
  16. Double sum = 0;
  17.  
  18. Console.WriteLine("Введите N:");
  19. int n = int.Parse(Console.ReadLine());
  20. Console.WriteLine("Введите X:");
  21. double x = double.Parse(Console.ReadLine());
  22.  
  23. double q = 1.0;
  24.  
  25. for (i = 1; i <= n; i++)
  26. {
  27. s += q;
  28. q *= x*x/ (2 * i);
  29. Console.WriteLine("n={0} \t q={1} \t Сумма: {2}", i, q, s);
  30. }
  31.  
  32. sn = Math.Cosh(x);
  33. Console.WriteLine("Сумма: {0}", s);
  34. Console.WriteLine("Сумма Cosh: {0}", sn);
  35. Console.ReadKey();
  36.  
  37. }
  38. }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement