Posts

Showing posts from January, 2017

A Simple C program to convert DECIMAL to BINARY

Image
A Simple C program to convert DECIMAL to BINARY   1   #include<iostream>   2   #include<stdio.h>   3   using namespace std ;   4   int main ()   5   {   6       int n , arr [ 100 ] ;   7       int i = 0 , j ;   8       cout << "Enter the decimal number --->   " ;   9       cin >> n ; 10       // using while loop to store in arr[] 11       while ( ( n / 2 ) >= 1 ) 12       { 13           arr [ i ++]= ( n % 2 ); 14           n = n / 2 ; 15       } 16       if ( n == 3 ) 17       { 18   ...