Easy learning with example program codes

CPP program to convert a decimal number into a binary number

Decimal System: A number system with base 10 i.e, numbers from 0-9 are used to represent a decimal number system.

Binary System: A number system with base 2 i.e, only binary numbers 0 and 1 are used to represent a binary number system.


#include <iostream.h>
using namespace std;
int main()
int arr[20];
int num,i;    
cout << "Enter the number: ";    
cin >> num;  
int n= num;
arr[i] = num%2;    
num = num/2;    
cout << "Binary Value of " << n << " is: ";
for(i=i-1; i>=0; i--)    
cout << arr[i];    
return 0;


Enter the number: 15
Binary value of 15 is: 1111
Posted in CPP   

Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at


We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on

Copyright © 2019 CodesJava Protection Status SiteMap Reference: Java Wiki