42 project | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

42 project

https://code.sololearn.com/cxx5EcPyb5vg/?ref=app Что не так почему не работает код ? :(

1st Feb 2022, 11:14 PM
Me Lex
Me Lex - avatar
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)); } }
1st Feb 2022, 11:51 PM
L.M.Paredes
L.M.Paredes - avatar