Write Java statements not a whole program to accomplish the

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

if(result<0)
{
   result--;
   System.out.print(\"Result is\");
   System.out.println(result);
}
else
{
   System.out.println(\"Positive\");
   System.out.print(\"Result is\");
   System.out.println(result);
}

 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 d

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site