11

C++ Program to Convert Octal Number to Decimal and vice-versa

 3 years ago
source link: https://www.geeksforgeeks.org/videos/c-program-to-convert-octal-number-to-decimal-and-vice-versa/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

C++ Program to Convert Octal Number to Decimal and vice-versa

C++ Program to Convert Octal Number to Decimal and vice-versa
Hello friends. Welcome to Geeks. Forgive third, today's
  • 17/06/2022

In this video, we will write a C++ program to Convert Octal Number to Decimal and vice-versa.

Decimal to Octal Conversion:

Algorithm: Step 1: Remainder is stored when the number is divided by 8 in an array. Step 2:Divide the number by 8 now Step 3:Repeat the above two steps until the number is not equal to 0. Step 4:Print the array in reverse order now.

Octal to Decimal Conversion:

Algorithm: Step 1: The idea is to extract the digits of a given octal number starting from the rightmost digit and keep a variable decimal value. Step 2: At the time of extracting digits from the octal number, multiply the digit with the proper base (Power of 8) and add it to the variable decimal value. Step 3: In the end, the variable decimal value will store the required decimal number.

Octal to Decimal Conversion: https://www.geeksforgeeks.org/program-octal-decimal-conversion/

Decimal to Octal Conversion: https://www.geeksforgeeks.org/program-decimal-octal-conversion/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK