You can add your comments and suggestions -if any- at the comment section below each set of codes
Regards All
Ex 4: write a c++ program that calculate the following series summation:
S= 1+ 2/4 + 3/9 + 4/16 +… + 10/100
int i; double s=0.0;
cout<<"\nThis Program Calculate the the following "
<<"Series :\nS= 1+ 2/4 + 3/9 + 4/16 + .....+10/100"<
for( i=1;i<=10;i++)
s+=(i/pow(i,2));
cout<<"\nSeries Sum ="<<
cout<<"--------------------------\n";
Ex 5: write a c++ program that calculate the following formula:
F= 1/ 1! + 2/2! + 3/3! + … + 4/4!+ 5/5!
int n = 0, fact = 1, accuracy = 10;
double e = 1;
while ( ++n < accuracy ) {
fact *= n;
e += 1.0 / fact;
}
cout << "e value is " << e << endl;