Ask Question
24 July, 06:52

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.

+5
Answers (1)
  1. 24 July, 08:12
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers