decimal to octal Algorithm
Positional notation (or place-value notation, or positional numeral system) denotes normally the extension to any base of the Hindu – In modern positional systems, such as the decimal system, the position of the digit means that its value must be multiply by some value: in 555, the three identical symbols represent five hundreds, five tens, and five units, respectively, due to their different positions in the digit string. Some of those pro-decimal attempts — such as decimal time and the decimal calendar — were unsuccessful. count rods and most abacuses have been used to represent numbers in a positional numeral system. Before positional notation became standard, simple additive systems (sign-value notation) such as Roman numerals were used, and accountants in ancient Rome and during the center age used the abacus or stone counters to do arithmetical.
/*****Decimal to octal conversion*******************/
#include <stdio.h>
void decimal2Octal(long decimalnum);
int main(){
long decimalnum;
printf("Enter the decimal number: ");
scanf("%ld", &decimalnum);
decimal2Octal(decimalnum);
return 0;
}
/********function for convert decimal numbers to octal numbers************/
void decimal2Octal(long decimalnum){
long remainder, quotient;
int octalNumber[100], i = 1, j;
quotient = decimalnum;
while (quotient != 0){
octalNumber[i++] = quotient % 8;
quotient = quotient / 8;
}
for (j = i - 1; j > 0; j--)
printf("%d", octalNumber[j]);
printf("\n");
}