+ 1
Why does my Code not work?
3 Answers
+ 3
Hellu, for the first you created the variable inside of the if statements, you will not be able to use the variable outside of the if statements so add this line above the if statements somewhere
int result = 0;
then remove the int and replace with
result = num1 + num2;
And i would use char instead of String for the oparator
char operator = sc.next().charAt(0);
Also make sure to change "+" to '+'
Should work
+ 3
Good goodđ
+ 1
Thanks, it works now JavaBobbo