You did not show line 28 as error message indicates.
Your result will be always 1 since int division: 1/(e*i) always 0.
You should declare double e = 1.0 instead of int e;
For example, the java method in calculating PI using Lord formula could be:
double Lord(int n) { // n represents number of iterations/terms
double pi =1;
double sqroot;
for (int i = 3 ; i <n ; i +=2 )
pi += 1.0/(i*i);
pi = Math.sqrt(pi*8);
return pi;
}
The calculation is arried out in terms of double instead of int type.
The java program is presented in terms of class. In C/C++ you may not define a class, but in Java you have to.
Please tell me how to delete my post? I have some posts to be deleted.