#include <iostream>
      #include <cmath>
      
      using namespace std;
      int decimalToOctal(int decimalNumber);
      // Function to convert decimal number to octal
      int decimalToOctal(int decimalNumber)
      {
        int rem, i = 1, octalNumber = 0;
        while (decimalNumber != 0)
        {
          rem = decimalNumber % 8;
          decimalNumber /= 8;
          octalNumber += rem * i;
          i *= 10;
        }
        return octalNumber;
      }
      
      Cpp language logo

      Decimal to Octal

      0

      1

      avatar
      Giovanny Gongora
      Codiga's C++ Recipes

      Convert decimal number to octal

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.