Computer Science, asked by dhanyags2004, 7 months ago

write a c++ program to find integer number into binary equivalent
plz urgent ​

Answers

Answered by vaishnavi6267
0

Explanation:

Decimal to Binary Conversion Algorithm

Step 1: Divide the number by 2 through % (modulus operator) and store the remainder in array

Step 2: Divide the number by 2 through / (division operator)

Step 3: Repeat the step 2 until the number is greater than zero

Let's see the C++ example to convert decimal to binary.

#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];

}

}

hope the answer is helpful

kindly mark me as a brainliest

and follow me....

Similar questions