Anonymous School 🏫
(Minds of Hacker)
----------------------
Write a C++ Programs to convert Binary number to Decimal number
#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