0 votes
in JAVA by
Write a program to convert decimal numbers to octal.

1 Answer

0 votes
by
Write a program to convert decimal numbers to octal.

import java.util.Scanner;

class star

{

  public static void main(String args[])

  {

    Scanner sc = new Scanner( System.in );

    System.out.print("Enter a decimal number : ");

    int num =sc.nextInt();

    String octal = Integer.toOctalString(num);

    System.out.println("Decimal to octal: " + octal);

  }

}

Related questions

+1 vote
asked May 7, 2021 in JAVA by sharadyadav1986
0 votes
asked Oct 24, 2020 in JAVA by sharadyadav1986
...