Skip to content

Commit

Permalink
Merge pull request #37 from jasmine-24/main
Browse files Browse the repository at this point in the history
Decimal to Binary
  • Loading branch information
PrajaktaSathe authored Oct 24, 2021
2 parents d0b8ae9 + aebdfd7 commit b966598
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions other programs/DecimalToBinary.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;
int main()
{
int a[10], n, i;
cout<<"Enter the number to convert: ";
cin>>n;
for(i=0; n>0; i++)
{
a[i]=n%2;
n= n/2;
}
cout<<"Binary of the given number= ";
for(i=i-1 ;i>=0 ;i--)
{
cout<<a[i];
}
}

0 comments on commit b966598

Please sign in to comment.