Moved programs to appropriate directories

This commit is contained in:
ashwek
2019-02-12 20:32:46 +05:30
parent bd6c8a3531
commit e946cc8291
10 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
// This function convert decimal to binary number
//
#include <iostream>
using namespace std;
int main()
{
int number;
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 << "the binary is :";
cout << binary;
cout << endl;
return 0;
}