Posts

Showing posts from December, 2022

The number of required [n x 1] multiplexer to implement one [m x 1] multiplexer.

  /****************************************************************************** This is a program to find the number of required (m x 1) multiplexer to implement one (n x 1) multiplexer. And m is always even, otherwise we are wasting the bit(s). If your m is odd then increase it by one. *******************************************************************************/ #include <stdio.h> int main() {     int n, m, x, y = 0;      printf("This is a program to find the number of required (m x 1) multiplexer to implement one (n x 1) multiplexer. And m is always even, otherwise, we are wasting the bit(s). If your m is odd then increase it by one.\n");     printf("Enter the value of n:\t");     scanf("%d", &n);     printf("Enter the value of m:\t");     scanf("%d", &m);     if(n>m){         x = n;         while(x > m){             //If x is odd then we need an another multiplexer.             if( x%2 == 0 ){             x =

The number of required [n x 1] multiplexer to implement one [m x 1] multiplexer. Only for even [n/m].

/****************************************************************************** This is a program to find the number of required (n x 1) multiplexer to  implement one (m x 1) multiplexer, only when n/m never gives odd or decimal number . *******************************************************************************/ #include <stdio.h> int main() {     int n, m, x, y = 0;     printf("Enter the value of n:");     scanf("%d", &n);     printf("Enter the value of m:");     scanf("%d", &m);     if(n>m){         x = n;         while(x > m){             x = x/m;             y = y + x;         }         printf("%d", y+1);     }     else         printf("1");     return 0; }