Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. double e;
  13. e = double.Parse(Console.ReadLine());
  14. double p = 0;
  15. double s = 0;
  16. int br = 1;
  17. double c = 1;
  18. while (Math.Abs(c) <= e)
  19. {
  20. c = (double)1 / br;
  21. br += 2;
  22. br *= -1;
  23. s += c;
  24. }
  25. p = s * 4;
  26. Console.WriteLine(p.ToString("0.00"));
  27. Console.ReadLine();
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement