42 project | Sololearn: Learn to code for FREE!

0

42 project

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

2/1/2022 11:14:03 PM

Me Lex

1 Answer

New 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)); } }