InterviewSolution
Saved Bookmarks
| 1. |
Can someone explain me series questions in java in the given image |
|
Answer» tion:The main program BEGINS at double p=0 ; : assigns p a FLOAT value of 0.for (int i =0; i<=n; i++) : Begins a for loop and runs it n+1 times, every time increasing i by 1.p =p + double(Math.pow(x,i)/i); : increases p by every time the loop runs.Math.pow(x,i): returns x RAISED to the POWER of i.System.out.println("p="+p) : print the last value of p since it is out of hte loop brackets {}. |
|