in JAVA by
Q:
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);

  }

}
Click here to read more about JAVA
Click here to read more about Insurance

Related questions

0 votes
asked Oct 24, 2020 in JAVA by sharadyadav1986
0 votes
asked Dec 3, 2019 in JavaScript by rajeshsharma
+1 vote
asked Feb 15 in Python by SakshiSharma
0 votes
asked Jun 16, 2020 in C Sharp by Hodge
0 votes
asked Oct 22, 2020 in JAVA by sharadyadav1986
...