number system

Discussion in 'C' started by sayantani nath, Aug 28, 2010.

  1. sayantani nath

    sayantani nath New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    how to make a number system program in c?
     
  2. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    19
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    http://www.techgeek.in
    I think you are talking about the number system conversion programs...If you want to convert a decimal number into binary number system then here is the code..
    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<math.h>
    
    void dec_bin(long int num)   // Function Definition
    {
    long int rem[50],i=0,length=0;
    while(num&gt;0)
     {
     rem[i]=num%2;
     num=num/2;
     i++;
     length++;
     }
    printf("\nBinary number : ");
         for(i=length-1;i&gt;=0;i--)
                 printf("%ld",rem[i]);
    }
    //================================================
    void main()
    {
    long int num;
    clrscr();
     
     printf("Enter the decimal number : ");
     scanf("%ld",&amp;num);
    
        dec_bin(num);   // Calling function
    
     getch();
    }
    
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice