Archived
1
0
This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SomeLab/cs3/C_Sharp_3_4/Program.cs
2025-10-24 17:19:46 +08:00

21 lines
433 B
C#

using System;
namespace C_Sharp_3_4
{
public class Program
{
static void Main(string[] args)
{
double n = 1, t = 1, pi = 0, s = 1;
while (Math.Abs(t) >= Math.Pow(10,-6))
{
pi += t;
n += 2;
s = -s;
t = s / n;
}
pi *= 4;
Console.WriteLine("pi={0}" ,pi);
}
}
}