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;

} 

Comments

Popular posts from this blog

My very 1st contest! | Problem - 1 | Beginner level | C language | CodeChef

Implementing linked list in C language