'PiBerechnen' ändern

master
Peter Ostmann 8 years ago
parent 49319029be
commit d43acbc181

@ -1,10 +1,7 @@
using System; using System;
namespace B_GOP01XX_AG_1 namespace B_GOP01XX_AG_1
{ {
// Aufgabenschritt 1 - Klassendefinition // Aufgabenschritt 1 - Klassendefinition
class WallisschesProdukt { class WallisschesProdukt {
@ -15,13 +12,9 @@ namespace B_GOP01XX_AG_1
for(double i = 1; i < Convert.ToDouble(n); i++, step++) for(double i = 1; i < Convert.ToDouble(n); i++, step++)
{ {
if (i % 2 == 0){ if(i%2 == 0) halfPI *= (step / (step+1)); else halfPI *= ((step+1) / step);
halfPI *= (step / (step+1));
}
else {
halfPI *= ((step+1) / step);
}
} }
return halfPI * 2.0; return halfPI * 2.0;
} }
} }
@ -38,7 +31,6 @@ namespace B_GOP01XX_AG_1
static int tableWidth = 77; static int tableWidth = 77;
public void PrintLine() public void PrintLine()
{ {
Console.WriteLine(new string('-', tableWidth)); Console.WriteLine(new string('-', tableWidth));
@ -57,7 +49,6 @@ namespace B_GOP01XX_AG_1
Helper testNow = new Helper(); Helper testNow = new Helper();
testNow.adjustBuffer(); testNow.adjustBuffer();
Console.WriteLine(String.Format("{0, 0}{1,-5}{2, 0}{3, 0}","Faktor:","","","Walissches Produkt:")); Console.WriteLine(String.Format("{0, 0}{1,-5}{2, 0}{3, 0}","Faktor:","","","Walissches Produkt:"));
for (int i = 1; i <= 1000; i++) { for (int i = 1; i <= 1000; i++) {

Loading…
Cancel
Save