public class DecimalToOctal { public static void main ( String args[]) { Scanner input = new Scanner(System.in); System.out.print("Enter number: "); int oct = input.nextInt(); String result= Integer.toString(oct,8); System.out.println(result); } }
output : Enter number: 8 10