This simple program will ask the user to give a number and then our program will convert the given number by the user into binary equivalent. The program is very easy to understand and use.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
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_binary.java
package hello;
import java.util.Scanner;
public class Decimal_binary {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int values = 0;
System.out.println("Decimal To Binary Converter in Java");
System.out.println();
System.out.print("Enter a Number : ");
values = input.nextInt();
String binary_value = Integer.toBinaryString(values);
System.out.println("The Binary Value is : " + binary_value + ".");
System.out.println();
System.out.println("\t End of Program");
}
}
No comments:
Post a Comment