Ask Question
28 September, 08:28

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. 28 September, 10:48
    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?
Get 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 there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers