Write a boolean expression that evaluates to true if the number is between 1 and
ID: 3638946 • Letter: W
Question
Write a boolean expression that evaluates to true if the number is between 1 and 100 or the number is negative.Explanation / Answer
First of all, the number needs to be between 1 and 100 --> 1 1) AND (num < 100) --> the AND can also be && in most progr. languages the second part is 'num is negative' --> ( num < 0 ) since it's either 'between 1 and 100' OR 'negative', you use the OR to chain the two together, putting the first one in brackets (this is not really necessary, since AND is stronger than OR, but it helps visually. in fact, you don't need any brackets in this case) --> (( num > 1 ) AND (num < 100)) OR (num < 0)Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.