Question:

I c programming how can I convert a octal number to an integer?

by  |  earlier

0 LIKES UnLike

How do I use the atoi function?

 Tags:

   Report

1 ANSWERS


  1. You wouldn't use atoi for that.

    Octal

    The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7.

    Numerals can be made from binary numerals by grouping consecutive digits into groups of three (starting from the right).

    For example, the binary representation for decimal 74 is 1001010, which groups into 001 001 010 — so the octal representation is 112.

    Octal – Decimal Conversion

    Example: Convert octal 764 to decimal system. 764 (base 8) = 7 x 8² + 6 x 8¹ + 4 x 8° = 448 + 48 + 4 = 500 (base 10)

    For double digit numbers this method amounts to taking the first number,

    multiplying it by 8 and then adding the second to get the total.

    Example: 65 in octal would be 53 in decimal (6*8 + 5 = 53)

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.