
ayudaaa binario a decimañ usando recursividad sin ciclos
Publicado por MRX (16 intervenciones) el 30/03/2018 03:21:50
nesecito ayudaa
nesecito que no lleve ningun ciclo & que tenga recursividad
nesecito que no lleve ningun ciclo & que tenga recursividad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package taller2;
import java.util.Scanner;
public class decimalabinario2 {
public decimalabinario2() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner decimal = new Scanner(System.in);
int residuo = 0;
System.out.print("ingese un numero dcimal:");
String num = decimal.nextLine();
int cociente = Integer.parseInt(num);
while (cociente !=0) {
residuo = cociente % 2;
cociente = cociente /2;
System.out.println(residuo);
}
}
}
Valora esta pregunta


0