Monday, July 2, 2018

C program convert a decimal number into binary number using reccursion

    /*

     * C Program to Convert a Number Decimal System to Binary System using Recursion

     */

    #include <stdio.h>



    int convert(int);



    int main()

    {

        int dec, bin;



        printf("Enter a decimal number: ");

        scanf("%d", &dec);

        bin = convert(dec);

        printf("The binary equivalent of %d is %d.\n", dec, bin);



        return 0;

    }



    int convert(int dec)

    {

        if (dec == 0)

        {

            return 0;

        }

        else

        {

            return (dec % 2 + 10 * convert(dec / 2));

        }

    }

1 comment:

  1. A number is a concept that arises from the result to have things that are an aggregate or a generalization of this concept.
    numbers information

    ReplyDelete

The depression in freezing point of water observed for the same amount of acetic acid, trichloroacetic acid and trifluoroacetic acid increases in the order given above. Explain briefly.

  Depression in freezing point is a colligative property that depends on the number of solute particles in a solution. Since the order of de...