#include <iostream>
      #include <cmath>
      
      using namespace std;
      // function prototype
      int convert(long long);
      // function definition
      int convert(long long n) {
        int dec = 0, i = 0, rem;
        while (n!=0) {
          rem = n % 10;
          n /= 10;
          dec += rem * pow(2, i);
          ++i;
        }
        return dec;
      }
      

      Cpp language logoBinary to Decimal

      Codiga's C++ Recipes

      Convert binary number to decimal

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.