From 210a0d47f48989431ae26c14a4372a2c7169dc42 Mon Sep 17 00:00:00 2001 From: soulzstriker Date: Thu, 2 Aug 2018 17:02:37 +0800 Subject: [PATCH 1/2] Clean up the HTML comments --- Decimal To Binary.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/Decimal To Binary.cpp b/Decimal To Binary.cpp index 3794d2a96..682cb6b05 100644 --- a/Decimal To Binary.cpp +++ b/Decimal To Binary.cpp @@ -1,20 +1,24 @@ -#include +// This function convert decimal to binary number +// +#include "stdafx.h" +#include using namespace std; + int main() { int number; - cin>>number; - int remainder,binary=0,var=1; - -do{ - - remainder=number%2; - number=number/2; - binary=binary+(remainder*var); - var=var*10; + cout << "Enter a number:"; + 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); - cout<0); + cout << "the binary is :"; + cout << binary; + cout << endl; } From e9dadc014870c6366fd9c5c271f9f36ab43c7c6d Mon Sep 17 00:00:00 2001 From: Ashwek Swamy <39827514+ashwek@users.noreply.github.com> Date: Sat, 9 Feb 2019 12:54:49 +0530 Subject: [PATCH 2/2] Update Decimal To Binary.cpp --- Decimal To Binary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Decimal To Binary.cpp b/Decimal To Binary.cpp index 682cb6b05..b8eaba1f1 100644 --- a/Decimal To Binary.cpp +++ b/Decimal To Binary.cpp @@ -1,6 +1,5 @@ // This function convert decimal to binary number // -#include "stdafx.h" #include using namespace std; @@ -21,4 +20,5 @@ int main() cout << "the binary is :"; cout << binary; cout << endl; + return 0; }