Thanks Write Java statements not a whole program to accompli

Thanks!
Write Java statements (not a whole program) to accomplish the following: When the value of result is less than 0 decrement the value of result by 1 using the decrement operator, otherwise print this message: \"Positive Then, in either case, display the value of the variable result labeled with \"Result is \".

Solution

int result;

if(result < 0) //check if reult is less than 0

result--; //decrement the value of result by 1

else

System.out.println(\"Positive\"); //else display Positive

System.out.println(\"Result is \" + result); //print the value of result . This statement is not part of else

Thanks! Write Java statements (not a whole program) to accomplish the following: When the value of result is less than 0 decrement the value of result by 1 usin

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site