Hai Team
i am new to Java programming language.i want to write a program on printing the sum of harmonic
series for a given value of 'n' 1+1/2+1/3.......1/n
please do help me on this issue along with the code
Thanks in Advance
kundan
:confused:
Printable View
Hai Team
i am new to Java programming language.i want to write a program on printing the sum of harmonic
series for a given value of 'n' 1+1/2+1/3.......1/n
please do help me on this issue along with the code
Thanks in Advance
kundan
:confused:
Code :public double sumHarm(int n){ int total = 0; for(int i = 1; i <= n; i++) total += (1.0/i); return total; }
Something like that should do it.
Regards,
Chris
Hi Chris
Thanks alot it worked out for me
thank you very much
have a great day
:cool: