Computer Science, asked by patnaiksoumya9, 5 hours ago

if a==10,b=3 then find the value of a=9||b>12 in c language.​

Answers

Answered by anindyaadhikari13
2

\textsf{\large{\underline{Correct Question}:}}

  • If a = 10, b = 3, find the value of a == 9 || b > 12.

\textsf{\large{\underline{Answer}:}}

  • false.

\textsf{\large{\underline{Explanation}:}}

The operator '==' checks whether two values are equal or not and '>' checks whether the first value is greater than the second one.

Here, the value of the variable 'a' is 10. Therefore a == 9 will be false as 'a' is not equal to 9.

→ a == 9 = false — (i)

Again, the value of b is 3. So, b > 12 returns false as b is less than 12.

→ b > 12 = false — (ii)

Now, combine both (i) and (ii),

a == 9 || b > 12

= false || false

In case of 'OR' operator. if any one of the conditions is true, the result is true. But all the conditions is false. Therefore,

→ a == 9 || b > 12 = false.

\textsf{\large{\underline{Additional Information}:}}

Logical Operators: It is used to compare two or more relational operations. There are three logical operators:

1. Logical AND.

\boxed{\begin{array}{c|c|c}\sf\underline{Condition\ 1}:&\sf\underline{Condition\ 2}:&\sf\underline{Condition\ 1\ \&\&\ Condition\ 2}:\\ \sf True&\sf True&\sf True\\ \sf True&\sf False&\sf False\\ \sf False&\sf True&\sf False\\ \sf False&\sf False&\sf True\end{array}}

2. Logical OR.

\boxed{\begin{array}{c|c|c}\sf\underline{Condition\ 1}:&\sf\underline{Condition\ 2}:&\sf\underline{Condition\ 1\ \&\&\ Condition\ 2}:\\ \sf True&\sf True&\sf True\\ \sf True&\sf False&\sf True\\ \sf False&\sf True&\sf True\\ \sf False&\sf False&\sf True\end{array}}

3. Logical NOR.

\boxed{\begin{array}{c|c}\sf\underline{Condition}:&\sf\underline{!\: Condition}:\\ \sf True&\sf False\\ \sf False&\sf True\end{array}}

Similar questions