From dbaf69f0e0ede46cbf5765cb6ca9500fcd7a3ea7 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 12 Nov 2021 09:23:19 +0200 Subject: Divided C and C++ files into seperate folders --- C_C++/LeibnizPI.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 C_C++/LeibnizPI.cpp (limited to 'C_C++/LeibnizPI.cpp') diff --git a/C_C++/LeibnizPI.cpp b/C_C++/LeibnizPI.cpp deleted file mode 100644 index 2243f61..0000000 --- a/C_C++/LeibnizPI.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -using namespace std; - -int main() -{ - cout << "n = "; - unsigned int n = 1; - cin >> n; - long double pid4 = 1; - - for(unsigned int i = 0, dvsr = 3; i < n; i++, dvsr += 2) { - pid4 += ((i % 2) ? 1.0 : -1.0) / dvsr; - } - - cout.precision(64); - cout << endl << pid4 * 4.0 << endl; - - return 0; -} - -/* This is a quick implementation of of the Leibniz formula for PI - * https://en.wikipedia.org/wiki/Leibniz_formula_for_%CF%80 - * - * Fun fact: you need around 100 million iterations for 7 correct decimal places - */ -- cgit v1.2.3