What is the problem in this code?
the condition is you have to uncomment only one line from this code where two line are commented
y=x*y;
y=x+y;
the output: first 12 and then 2
public class Solution{
public static void main(String[] args){
int x=2;
int y=12;
y=x+y;//this line is uncommented //
x=y-x;
y=y-x;
System.out.print(x);
System.out.print(y);}}
What is the problem in this code?
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Guadalupe Gagnon
21 January 2019, 20:23
It looks like you modified the code. your code shows System.out.print() while the original task code has System.out.println(). Otherwise you have the correct answer. Try resetting the problem and only uncomment the correct line.
0
Divya vats
22 January 2019, 17:14
Thank you Sir, for the reply but I got the output after published the problem .
+1