
i need a program to convert a decimal num into binary num in java language by using array and loop

Java Convert decimal to binary
import java.util.*;
public class DecimalToBinary{
public static void main(String args[]){
Scanner input=new Scanner(System.in);
System.out.println("Enter the decimal value:");
int num = input.nextInt();
String binary = Integer.toBinaryString(num);
System.out.println("Binary: " + binary);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.