Saturday, June 25, 2016

Decimal To Octal Converter in Java

This simple program will ask  the user to give a  number and then our program will convert the given number by the user into octal equivalent. The program is very easy to understand and use.


 Add me at Facebook my address  is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output


Program Listing

decimal_octal.java

package hello;

import java.util.Scanner;

public class decimal_octal {

public static void main(String args[]) {

Scanner input = new Scanner(System.in);
int values = 0;

System.out.println("Decimal To Octal Converter in Java");
System.out.println();
System.out.print("Enter a Number : ");
values = input.nextInt();

String octal_value = Integer.toOctalString(values);

System.out.println("The Octal Value is : " + octal_value + ".");
System.out.println();
System.out.println("\t End of Program");
}
}

No comments:

Post a Comment