Ask Question
25 December, 17:49

Write a statement that uses a conditional expression that determines if the credits variable is less than 0. If the condition is true, assign the value 0 to the credits variable, otherwise the value of the credits variable should remain unchanged.

+3
Answers (1)
  1. 25 December, 17:59
    0
    The statement and the expression is "credits = credits<0?0 : credits; " for the above question.

    Explanation:

    The conditional expression is an expression that is used to determine the true and the false case. It works like the if and the else statement. It has three parts which are shown above, in which the first part is to check the condition, the second part is excuted if the condition is true and the third part is executed if the condition is false. The variable is used to assign the value. If any user provides the credit value and writes the above statement then the credit variable holds 0 for negative value and it holds the original value for any positive or zero value.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a statement that uses a conditional expression that determines if the credits variable is less than 0. If the condition is true, ...” 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