0
42 project
https://code.sololearn.com/cxx5EcPyb5vg/?ref=app Что не так почему не работает код ? :(
1 Answer
0
import java.util.Scanner;
//введите код сюда
public class Converter {
public static String toBinary(int num){ //you must put the value returned by the function either int, string, void, ...
String binary="";
while(num > 0) {
binary= (num%2)+binary;
num /= 2;
}
return binary; //return the value
}
}
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));
}
}