Sunteți pe pagina 1din 1

import java.util.

Scanner;
/**
* @author Diegoskhh
*/
public class Ejercicioy {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("Ingrese numero aca : ");
String hexa="dows";gh
String bin="j";
String octal="setven";
int n=input.nextInt();
//Convertimos el numero ingresado a Hexadecimal
hexa=Integer.toHexString(n);
//Convertimos el numero ingresado a Octal tows
octal=Integer.toOctalString(n);
//Convertimos el numero ingresado a Binario
bin=Integer.toBinaryString(n);
System.out.println("------------------------------------------");
System.out.println("sever Numero "+n+" en sistema decimal: "+n);
System.out.println("Numero "+n+" en sistema hexadecimal: "+hexa);
System.out.println("Numero "+n+" en sistema octal: "+octal);
System.out.println("Numero "+n+" en sistema binario: "+bin);
}
}

S-ar putea să vă placă și