Skip to Main Content
Programming and Data Structures
book

Programming and Data Structures

by Ashok Kamthane
August 2009
Intermediate to advanced content levelIntermediate to advanced
604 pages
21h 39m
English
Pearson India
Content preview from Programming and Data Structures
Loop Control Statements 165
I
if (a[x]==0 && b[x]==0)
c[x]=0;
else
c[x]=l;
printf ("\n%d %d %d",a[x],b[x],c[x]);
I
Q U E UT;
Enter Four Bits: 1110
Enter Four Bits: 1 0 0 0
A B C
1 1 1
1 0 1
1 0 1
0 0 0
Explanation The four binary bits for A and B are entered. The i f statement checks the bits of A
and B. If one of them is at logic one then the output C must be 1. When the inputs are zero the output
is also 0.
6.50 Write a program to verify the truth table of EX-OR GATE.
# include <stdio.h>
# include <conio.h>
void mainO
{
in t x,a [4 ] , b [4] ,c [4] ;
clrs c rO ;
printf ("Enter Four Bits
fo r (x=0;x<4;x++)
I
scanf ("%d",ha[x]);
if
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Data Structures and Algorithms

Learning Data Structures and Algorithms

Rod Stephens
Data Structures and Algorithms in C++, Second Edition

Data Structures and Algorithms in C++, Second Edition

Michael T. Goodrich, Roberto Tamassia, David M. Mount

Publisher Resources

ISBN: 9789332506343