Clarification on "Logical OR"

rhodium1trading
38

if both conditions are true in a logical OR statement, what will be the outcome?

Eg -  if (A=1) then C=1

if (B=1) then C=1

so, accordingly, 

if (A=1) || (B=0) then C should be 1

if (A=0) || (B=1) then C should be 1

if (A=1) || (B=1) then what will be the C? is it still C=1 when both conditions are true?   

pls help to clarify.

Yohana Parmi
10580
Yohana Parmi  
rhodium1trading:

if both conditions are true in a logical OR statement, what will be the outcome?
Eg -  if (A=1) then C=1
if (B=1) then C=1
so, accordingly,
if (A=1) || (B=0) then C should be 1
if (A=0) || (B=1) then C should be 1
if (A=1) || (B=1) then what will be the C? is it still C=1 when both conditions are true?   
pls help to clarify.

OR (logical disjunction) is only looking for one of the other condition is met.

Moreover, if there are 2 conditions that are met,
then the operation is enough on the first condition: A==1,
- and B==1 will be ignored
(the process does not need to read B==1 because condition A==1 is met first.)

if(A==1||B==1) C=1; else C=0;

or

C=(A==1||B==1)? 1:0;
Md Atikur Rahman
139
Md Atikur Rahman  

According to logical OR statement

If A is FALSE  OR  B is FALSE, then C will be FALSE

If A is FALSE   OR  B is  TRUE, then C will be TRUE

If A is  TRUE   OR  B is FALSE, then C will be TRUE

If A is  TRUE  OR  B is  TRUE, then C will be TRUE


So, If (A==1 || B==1) then C=1 else C=0

if(A==1 || B==1)
        C=1;
else
        C=0;


William Roeder
26723
William Roeder  

rhodium1trading:

if (A=1) then C=1

if (B=1) then C=1

Yohana Parmi #:
C=(A==1||B==1)? 1:0;

Md Atikur Rahman #:

if(A==1 || B==1)
        C=1;
else
        C=0;

Don't use ints when you mean bool.

C= A==1||B==1;
rhodium1trading
38
rhodium1trading  
Thank you all for your valued comments.