0

what is wrong with my code

public class blah2 { public static void main (String args[]) { double num[] = {43.4, 435.55, 65.54}; double res = 0; for (int i = 0; i<4; i++) { num[i]+=res ; } double fina = res/4; System.out.println(fina); } }

19th Aug 2016, 4:46 PM
Anshul Rawal
Anshul Rawal - avatar
2 Answers
+ 2
Hint: In your code, you aren't changing the value of res at all.
19th Aug 2016, 4:52 PM
Zen
Zen - avatar
0
yeah got it. i wrote the shorthand statement wrong.
19th Aug 2016, 4:55 PM
Anshul Rawal
Anshul Rawal - avatar