Computer Science, asked by h3lpp1zz, 8 hours ago

Using JAVA programming language, create a number system conversion application that will do the following: Convert octal to decimal Convert octal to binary Convert octal to hexadecimal.

This is the SAMPLE OUTPUT:
NUMBER SYSTEMS APP (OCTALNUMBER SYSTEMS)
Operations:
Press [1] –Octalto DecimalConversion
Press [2] –Octalto BinaryConversion
Press [3] –Octalto Hexadecimal Conversion

Select operation: 1
Enter octal: 357
Decimalequivalent is 239

Attachments:

Answers

Answered by khushikhan692
0

Answer:

static void main(String[] args) {

int decimal = 78;

int octal = convertDecimalToOctal(decimal);

System.out.printf("%d in decimal = %d in octal", decimal, octal);

}

public static int convertDecimalToOctal(int decimal)

{

int octalNumber = 0, i = 1;

while (decimal != 0)

{

octalNumber += (decimal % 8) * i;

decimal /= 8;

i *= 10;

}

return octalNumber;

Similar questions