Почему код проекта из курса java не проходит тест #4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Почему код проекта из курса java не проходит тест #4

Вот код import java.util.Scanner; //введите код сюда public class Mmm{ public static int mm(int x, int y){ int val = 1; if(y != 0){ for(int i = y; i > 0; i--){ val *= x; } } if(y == 0){ val = 1; } return val; }. } public class Converter{ public static int toBinary(int in){ int res = 0; for(int i = 16; i > 0; i--){ int bol = in / Mmm.mm(2, i); if(bol == 1){ res += Math.pow(10, i); in -= Mmm.mm(2, i); } } res += in % 2; return res; } } 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)); } }

30th Nov 2021, 12:41 PM
Владислав Пономарёв
Владислав Пономарёв - avatar
1 Answer
30th Nov 2021, 3:12 PM
JaScript
JaScript - avatar