+ 2

finding the sum

UPDATE: thanks for the help and quick responses! I was able to figure it out, i was indeed missing the missing variable //result Thus answer : System.out.println(result); Thanks again!!! Ex: int x = 2; int y = 4; So it should print out System.out.println(6); // or sum = 6 For the sum right? But when i do it it gives me an error on the app, ill run it on net beans and see what it displays but for now would anyone be able to assit with what the error mght be as i believe there isnt one. Thanks much!

2nd Mar 2018, 11:55 PM
jacob hernandez
jacob hernandez - avatar
3 ответов
+ 15
so there is no 3rd variable , then u need to put x+y in the print statement System.out.print(x+y); or //if u can have a 3rd variable result , then int result=x+y; System.out.print(result); or //it can also be written as int result; System.out.print(result=x+y);
3rd Mar 2018, 1:04 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 5
System.out.println(x+y) Or sum=x+y; System.out.println(sum)
3rd Mar 2018, 12:02 AM
Sergiu Panaite
Sergiu Panaite - avatar
+ 3
Self correction The output was “result” lol
2nd Mar 2018, 11:57 PM
jacob hernandez
jacob hernandez - avatar