Ask Question
4 March, 11:33

Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6; otherwise it assigns false to fever.

+2
Answers (1)
  1. 4 March, 11:43
    0
    If (temperature>98.6) / / checking the condition

    {

    fever=true / / assigned the true value in the fever variable

    }

    else

    {

    fever=false / / assigned the false value in the fever variable

    }

    Explanation:

    Following is the description of statement

    In the given problem we used if/else statement block. The if block is when there condition is true otherwise it executed the else block. In the above answer, we check the condition of "temperature" variable in the if block. If the condition of " temperature" variable is greater than 98.6 then it assigns the true value in the "fever" variable otherwise control goes to else block and executed the statement inside the else block i. e assigned the false value in the "fever" variable.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write an if/else statement that assigns true to the variable fever if the variable temperature is greater than 98.6; otherwise it assigns ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers