+ 2
How to print the sum of the two variables?
INT x=2, INT y=4; INT result =x__ __; system.out.println();
5 Answers
+ 7
@Rayachoti Ravi. no need + sign
+ 6
int x=2, int y=5;
int res =x+y;
System.out.println("Sum of x and y :"+res );
+ 3
You got two variables, x and y. The sum operator is +, and the total sum is stored in another variable, named result. Finally, you have to print this variable 'result', by placing the variable inside the parentheses of println.
+ 2
thanks Alvaro
0
int result=x+y;
system. out.println(+result);