Value of pie using c++:
THEORY:
Pi is
the ratio of a circle's circumference to its diameter.
Pi is
also an irrational number,
which means that its value cannot be expressed exactly as a simple fraction.
Computers have calculated pi to
over three trillion digits.
- Pi to
10 digits: 3.1415926535
The
Greek letter π was first used to represent pi by
William Jones in 1706, because π was an abbreviation of the Greek word
for perimeter: "περίμετρος."
CODING:
#include<iostream.h>
#include<conio.h>
void main()
{
int i;
double p=0;
clrscr();
for(i=1;i<=100;i++)
{
if(i%2==0)
{
p=p-(4.0/(2*i-1));
}
else
{
p=p+(4.0/(2*i-1));
}
}
cout<<"value of
pi="<<p<<\"t";
getch();
}
OUTPUT:
Model syllabus (+3): Downoad
List of all practicals: Download
Get all Books: Download
- How to Prepare for IIT-JAM ⇠ ⇠ Click Here
- How to prepare for JEST ⇠ ⇠ Click Here
"The only reason for time is so that everything doesn't happen at once." Albert Einstein
Post a Comment