C++ Programs to convert Binary number to Decimal number

Write a C++ Programs to convert Binary number to Decimal number #include using namespace std; int main() { int num,temp,reminder,sum=



Anonymous School 🏫

            (Minds of Hacker)

----------------------


 Write a C++ Programs to convert Binary number to Decimal number


C++ Practical



#include<iostream>
using namespace std;
int main()
{
    int num,temp,reminder,sum=0,i=1;
    cout<<"Enter the binary number\n";
    cin>>num;
    temp=num;
    while(temp!=0)
    {
        reminder = temp%10;
        sum=sum+reminder*i;
        temp=temp/10;
        i=i*2;

    }
    cout<<"\nDecimal number= "<<sum;
}



Output:



Enter the binary number
1010

Decimal number= 10




 ****************Don't Make Learning Hard*****************

  Follow Us  



NextGen Digital... Welcome to WhatsApp chat
Howdy! How can we help you today?
Type here...