+ 2
A program-problem related to JAVA..........
import java.util.Scanner; public class Converter { public static String toBinary(int num) String binary=""; while(num>0) { binary =(num%2)+binary; num/=2; } return binary; } public class Program { public static void main(String[]args) Scanner sc=new Scanner(System.in); int x=sc.nextInt(); System.out.print(Converter.toBinary(x) ); }
3 Answers
+ 2
import java.util.Scanner;
public class Converter
{
public static String toBinary(int num){ //here
String binary="";
while(num>0)
{
binary =(num%2)+binary;
num/=2;
}
return binary;
}//here
}
public class Program
{
public static void main(String[]args){//here
Scanner sc=new Scanner(System.in);
int x=sc.nextInt();
System.out.print(Converter.toBinary(x) );
}//here
}
+ 3
you are missing some { }
toBinary(int num) {
code here
}
main(String [] args) {
}
+ 2
Please use relevant tags â
https://code.sololearn.com/W3uiji9X28C1/?ref=app