Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Binarios{
- public static void main(String[] args) {
- Scanner leer = new Scanner(System.in);
- System.out.print("ingrese un numero: ");
- long decimal=leer.nextLong();
- long aux = decimal;
- String binario = "";
- while(aux > 0){
- binario = aux%2+binario;
- aux /= 2;
- }
- System.out.println("El numero decimal "+decimal+" en binario es "+binario);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement