View Single Post
  #2 (permalink)  
Old April 11th, 2008, 03:27 PM
c.vikramnarayan c.vikramnarayan is offline
Registered User
 
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

#include<iostream.h>
#include<math.h>
void main()
{
    int decimal,binary = 0;
    int remainder,i=0;
    cout<<"\nEnter decimal number:";
    cin>>decimal;
    while(decimal>0)
    {
        remainder = decimal % 2;
        decimal = decimal / 2;
        binary = binary + remainder * pow(10,i);
        i++;
    }
    cout<<"\nThe binary output is :"<<binary;

}

This is a simple program to convert from decimal to binary... I can't exactly understand your question... Any doubt ask ill tell...

#9835;...Vikki...#9835;
Reply With Quote