Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

array sum

Hi,

I am workjing on below challenge

http://codingbat.com/prob/p175763

i wrote as below and passed all tests.

public int sum3(int[] nums) {
int num1=nums[0];
int num2=nums[1];
int num3=nums[2];

return num1+num2+num3;
  
}

Open in new window


i wonder how to improve my code. please advise
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
correction - that should say what HE provided.