Write a simple code in C for multiplexer i.e. 2 bitmux there are 2 control i/p a
ID: 3616258 • Letter: W
Question
Write a simple code in C for multiplexer i.e. 2 bitmux there are 2 control i/p and 4 regular i/p Ex- A B | To T1 T2 T3| output 0 0 | 1 X X X | 1 0 0 | 0 X X X | 0 0 1 | X 1 X X | 1 0 1 | X 0 X X | 0 X means ignore the input. Write a simple code in C for multiplexer i.e. 2 bitmux there are 2 control i/p and 4 regular i/p Ex- A B | To T1 T2 T3| output 0 0 | 1 X X X | 1 0 0 | 0 X X X | 0 0 1 | X 1 X X | 1 0 1 | X 0 X X | 0 X means ignore the input.Explanation / Answer
//Hope this will help you. #include void get_input(char *p,int *a) { do{ printf("Enter %s:",p); scanf("%d",a); }while(*a != 0 && *a!=1); } int main() { int a,b,t0,t1,t2,t3,output; get_input("A",&a); get_input("B",&b); get_input("T0",&t0); get_input("T1",&t1); get_input("T2",&t2); get_input("T3",&t3); if(a==0 && b==0) printf("Output = %d ",t0); else if(a==0 && b==1) printf("Output = %d ",t1); else printf("Undefined"); printf(" "); system("pause"); }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.