What is the correct way to check whether a variable x is divisible by 3 and divisible by 2 but not divisible by 5? if( (x%3 && x%2 && !x%5) if( (x%3 ==0) && (x%2 ==0) && !(x%5 ==0)) if( (x%3 ==0) && (x%2 ==0) ^ (x%5 ==0)) if( (x%3 ==0) && (x%2 ==0) || !(x%5 ==0))

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter23: Simulation With The Excel Add-in @risk
Section: Chapter Questions
Problem 6RP
icon
Related questions
Question

What is the correct way to check whether a variable x is divisible by 3 and divisible by 2 but not divisible by 5?

   

if( (x%3 && x%2 && !x%5)

   

if( (x%3 ==0) && (x%2 ==0) && !(x%5 ==0))

   

if( (x%3 ==0) && (x%2 ==0) ^ (x%5 ==0))

   

if( (x%3 ==0) && (x%2 ==0) || !(x%5 ==0))

Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage