Question

Draw the contents of an EVEN function for an input of 7 bits (i.e. it outputs ‘1’ if there are an even number of inputs enabled (set 1) or it outputs ‘0’ if there are an odd number of inputs enabled:

Draw the contents of an EVEN function for an input of 7 bits (i.e. it outputs ‘1’ if there are an even number of inputs enabled (set 1) or it outputs ‘0’ if there are an odd number of inputs enabled:

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>

int main(void){

int a;

int count=0;

int temp;

scanf("Enter a number %d",&a);

while(a>0){

temp=a%10;

if(temp == 1){

count++;

}

a = a/10;

}

if(count%2 == 0)

printf("Output is 1");

else

printf("Output is 0");

return 0;

}

Add a comment
Know the answer?
Add Answer to:
Draw the contents of an EVEN function for an input of 7 bits (i.e. it outputs ‘1’ if there are an even number of inputs enabled (set 1) or it outputs ‘0’ if there are an odd number of inputs enabled:
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT