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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- double e;
- e = double.Parse(Console.ReadLine());
- double p = 0;
- double s = 0;
- int br = 1;
- double c = 1;
- while (Math.Abs(c) <= e)
- {
- c = (double)1 / br;
- br += 2;
- br *= -1;
- s += c;
- }
- p = s * 4;
- Console.WriteLine(p.ToString("0.00"));
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement