Added Proper Indentation

Added proper indentation and using shorthand.
This commit is contained in:
Ashwek Swamy
2018-10-23 18:01:24 +05:30
committed by GitHub
parent 73fa353b0a
commit 7989930107

View File

@@ -1,20 +1,17 @@
#include<iostream>
using namespace std;
int main()
{
int main(){
int number;
cout <<"Enter number to find its binary : ";
cin>>number;
int remainder,binary=0,var=1;
do{
remainder=number%2;
number=number/2;
binary=binary+(remainder*var);
var=var*10;
}
while(number>0);
do{
remainder = number%2;
number /= 2;
binary += (remainder*var);
var *= 10;
}while(number>0);
cout<<binary;
return 0;
}