Ask Question

Does the Boolean expression count > 0 and total / count > 0 contain a potential error? If so, what is it?

+3
Answers (1)
  1. 20 June, 17:39
    0
    Assuming that all the necessary declarations are made and given statements are only an extract, we can conclude that the given piece of code contains error.

    Explanation:

    Let us analyze each one in order.

    count >0 This statement is right if we match this with the syntax of regular comparison operation. Here count is an operand, "0" is the constant operand and these two operands are operated by the operator ">".

    when we take total / count >0 Here count>0 returns Boolean and total is assumed to be an integer and an integer cannot be divided by a Boolean value. so it can be rectified as (total / count) >0.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Does the Boolean expression count > 0 and total / count > 0 contain a potential error? If so, what is it? ...” 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