+ 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!
3 Respostas
+ 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);
+ 5
System.out.println(x+y)
Or
sum=x+y;
System.out.println(sum)
+ 3
Self correction
The output was “result” lol