Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

i am new to c++ program and i new to make a program.?

a program that asks the user to enter an integer between 0 and 63, and then prints the number in octal (base The program should have the following :

Enter a number between 0 and 63: 28

The number in octal (base 8) is: 34

i know If n is an integer, then n%8 is the last digit of the octal number and n/8 is the first digit.

1 Answer

Relevance
  • 8 years ago
    Favorite Answer

    int numIn;

    int [] digits = new int(9);

    cout >> "Enter a number between 0 and 63";

    cin >> numIn;

    int i = 0;

    while (numin > 0 ) {

    digits[i++] = numin%8;

    numin /= 8;

    }

Still have questions? Get your answers by asking now.