I am trying to convert decimal to binary numbers from the user's input using Java but so far, I'm running into errors I'm not sure why. What am I doing wrong? Don't mind the naming, ultimately I would like to convert decimal into binary without using if and while statements. Also without using the decimaltobinary string.
Thanks a lot.
package r
public static void main(String[] args) {
int number;
int remainder;
Scanner in = new Scanner(System.in);
System.out.println("Enter a positive integer");
number=in.nextInt();
remainder= number %2;
System.out.print(remainder);
{
return null;
This is what I have so far.