Following is a program to Convert a Decimal number to a Binary number :
#include<iostream>
#include<cmath>
using namespace std;
int decimaltobinary(int n){
// Divison Method
int binaryno = 0;
int i = 0;
while(n>0){
int bit = n % 2;
binaryno += bit*pow(10,i);
// cout << binaryno << endl;
n = n/2;
i++;
}
return binaryno;
}
int main(){
int n;
cout << "Enter the number for its binary representation: ";
cin >> n;
int binary = decimaltobinary(n);
cout << binary << endl;
}