When I run this code without verification I get 20 but the system gives me 2 errors
1) Each of the variables (a, b, c, and d) in the line where the variable result is declared must be preceded by either a plus or minus sign. (BUT each of the variables is preceeded by a sign!
2) The plus and minus signs must be placed correctly. - So where? Why my solution is incorrect?
package com.codegym.task.task01.task0137;
/*
Only 20 will do
*/
public class Solution {
public static int a = 1;
public static int b = 3;
public static int c = 9;
public static int d = 27;
public static void main(String[] args) {
int result = + d - c + b - a;
System.out.println(result);
}
}
package com.codegym.task.task01.task0137;
/*
Only 20 will do
*/
public class Solution {
public static int a = 1;
public static int b = 3;
public static int c = 9;
public static int d = 27;
public static void main(String[] args) {
int result = +d -c +b -a;
System.out.println(result);
}
}