Bitwise Operators in C, OR gate Truth Table

C Programming Language Operators and Enums in C Language (Article) Operators and Enums in C Language (Program)

874

Program:

<span class="com">//OR gate Truth Table</span><span class="pln">

</span><span class="com">#include</span><span class="str">"stdio.h"</span><span class="pln">
</span><span class="kwd">void</span><span class="pln"> main</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
         
   printf</span><span class="pun">(</span><span class="str">" 0 | 0 = %d \n"</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">|</span><span class="lit">0</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
   printf</span><span class="pun">(</span><span class="str">" 0 | 1 = %d \n"</span><span class="pun">,</span><span class="pln"> </span><span class="lit">0</span><span class="pun">|</span><span class="lit">1</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
   printf</span><span class="pun">(</span><span class="str">" 1 | 0 = %d \n"</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">|</span><span class="lit">0</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
   printf</span><span class="pun">(</span><span class="str">" 1 | 1 = %d \n"</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">|</span><span class="lit">1</span><span class="pln"> </span><span class="pun">);</span><span class="pln">
      
</span><span class="pun">}</span>

Output:

 0 | 0 = 0
 0 | 1 = 1
 1 | 0 = 1
 1 | 1 = 1
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.