Method-1
package ensuretoday.blogspot.in;
import java.util.Scanner;
public class DecimalToBinary
{
public static void main(String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a Decimal Number ");
int str=sc.nextInt();
String s=Integer.toBinaryString(str);
System.out.println(s);
sc.close();
}
}
No comments:
Post a Comment