- #include <iostream.h>
- #include <conio.h>
- int main ()
- {
-
- double j, iterations, i, n, o, t, x, y;
-
- j=1;
- i=0;
- w=0;
- n=0;
- o=0;
- t=0;
- x=0;
- y=0;
-
-
- cout << "Bienvenue sur AlgoPI";
- cout <<endl;
-
- cout <<endl;
- cout << "Nombre d'itérations : ";
- cin >> iterations;
-
-
- for (i=0;i<w;i++)
- {
- cout <<i;
- cout <<endl;
- j+=2;
- n=-1/j;
- j+=2;
- o=1/j;
- t=n+o;
- x=t+x;
-
- }
-
- {
-
- y=4*(1+x);
- cout <<endl;
- cout <<endl;
- cout << "PI est egale a : ";
- cout <<y;
- cout <<endl;
- cout <<endl;
- getch();
-
-
- }
-
-
-
- return 0;
- }
#include <iostream.h>
#include <conio.h>
int main ()
{
double j, iterations, i, n, o, t, x, y;
j=1;
i=0;
w=0;
n=0;
o=0;
t=0;
x=0;
y=0;
cout << "Bienvenue sur AlgoPI";
cout <<endl;
cout <<endl;
cout << "Nombre d'itérations : ";
cin >> iterations;
for (i=0;i<w;i++)
{
cout <<i;
cout <<endl;
j+=2;
n=-1/j;
j+=2;
o=1/j;
t=n+o;
x=t+x;
}
{
y=4*(1+x);
cout <<endl;
cout <<endl;
cout << "PI est egale a : ";
cout <<y;
cout <<endl;
cout <<endl;
getch();
}
return 0;
}