Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. namespace ConsoleApplication2
  2. {
  3. class Program
  4. {
  5.  
  6. static long factorial(long n)
  7. {
  8. long toReturn = 1;
  9. for (int i = 2; i <= n; i++) {
  10. toReturn *= i;
  11. }
  12.  
  13. return toReturn;
  14. }
  15.  
  16. static void Main(string[] args)
  17. {
  18. double suma = 0.0;
  19. long x = 90;
  20. int k = 10;
  21. for (int i = 0; i <= k; i++)
  22. {
  23. suma += (Math.Pow(-1, k) * Math.Pow(x, 2 * k + 1)) / factorial(2 * k + 1);
  24. }
  25. Console.WriteLine(suma);
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement