➽ Program:-
import
java.util.*;
import
java.io.*;
class
Main
{
public static void main(String args[])
{
int decimal_number, octal_number = 0, i
= 1;
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Decimal
Number: ");
decimal_number = sc.nextInt();
while(decimal_number != 0)
{
octal_number += (decimal_number % 8)
* i;
decimal_number /= 8;
i *= 10;
}
System.out.print("Octal value is
"+octal_number);
}
}
➽ Output:-
Enter the Decimal Number: 92
Octal value is 134
0 Comments
Please do not enter any spam link in the comment section.