C++ Program that Convert Dec Number to Binary using Bitwise Oprt - 6 Players blogs for technology

give us your feedback

People Online

Breaking

ads

Post Top Ad

Tuesday, October 22, 2019

C++ Program that Convert Dec Number to Binary using Bitwise Oprt



C++ Program that Convert Dec Number to Binary using Bitwise Oprt 



#include <iostream>


using namespace std;


int main()

{
long dec,c,m,bit;
cout<< "Enter the  bit : ";
cin>>bit;
cout<< "Enter the Decimal :  ";
cin>>dec;
for(c=bit;c>=0;c--){
    m=dec>>c;
    if(m&1)
        cout<< "1";
    else
        cout<< "0";

}
return 0;
}















No comments:

Post a Comment

ads1

Post Top Ad