Why we need to declare double result=0 in the following program?
>
> class Average {
> public static void main(String args[]) {
> double nums[] = {10.1, 11.2, 12.3, 13.4, 14.5};
> double result = 0;
> int i;
> for(i=0; i<5; i++)
> result = result + nums[i];
> System.out.println("Average is " + result / 5);
> }
> }
>
> Thanks.
> CW
>-- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
