¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
Finish code to Convert Decimal to Binary, bin to dec, hexadec to dec, dec to hexadec, hexadec to binary & binary to hexadec.
public class Dec2Bin { public static void main(String[] args){ int num = 355; public static String dec2Bin(int preOp)// this is the integer before the operation. String tmpStr = null; Integer quo; Integer = mod; quo = preOp/2; mod = preOp%2; if(quo == 0) return tmpStr; else return tmpStr+dec2Bin(int preOp); } }
1 Respuesta
0
1. First of all your method cannot be inside main
2. what is the statement "Integer=mod"
3. return tmpStr+dec2Bin(int preOp); // why do you use int inside parentheses ?
4. There are missing '}'
5. Add your code to playground and share the link