Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions binarytodecimal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include<iostream>
#include<math.h>
using namespace std;

int main(){
int num,i=0,remainder=0;
int dec=0;
cout<<"Enter the numbers u wan to input:";
cin>>num;




while(num!=0){

remainder= num%10;

dec= dec + remainder*pow(2,i++);
num=num/10;
}
cout<<"The decimal conversion of the number is:";
cout<<dec;


}