Answer:
//Convert any decimal number to binary number
//Program is written in C++ Programming Language
// Comments are used for explanatory purpose
// Program starts here
#include <iostream>
using namespace std;
// Main Method declared here
int main()
{
int x;
cout<<"Enter any integer number: ";
cin>>x;
DecBin(x);
return 0;
}
// Here a function named DecBin is declared along with an integer variable, x
void DecBin(int x)
{
// Declare an array to store the resulting binary digits
int bindigit[32];
// counter for binary array
int kount = 0;
while (x > 0) {
// Store the remainder of each division in the declared array
bindigit[kount] = x % 2;
x = x / 2;
kount++;
}
// Loop to print the binary digits in reverse order
for (int j = i - 1; j >= 0; j--)
{
cout << bindigit[j];
}
}
// End of Program