Write an if statement that that decreases the variable shelfLife by 4 if the variable outsideTemperature is greater than 90. Assume the variables shelfLife and outsideTemperature have already been declared and assigned values.

Respuesta :

Answer:

// Below are the if-statement for the above code, which can run in c, c++ and java language.

if(outsideTemperature>90) //if-condition to check the condition.

          shelfLife=shelfLife-4; //assign the value.

Explanation:

  • The above code is written in c language, but it can run in c,c++ or java language.
  • There is one if condition which compares the value of "outsideTemperature" variable with 90, that the value of "outsideTemperature" is greater than 90 or not.
  • if the variable is less than 90 or equal to 90 then the original value of "shelfLife" will remain the same, otherwise, the value of "shelfLife" variable decreases by 4. this is also demand by the question.