Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Binario3 {
- public static void main (String args[]) {
- int numero= 156;
- int Resultado []= new int [32];
- int i= 0;
- while (numero > 0) {
- Resultado[i] = (numero%2);
- i++;
- numero= numero/2;
- }
- int j= Resultado.length - 1 ;
- while (Resultado[j] == 0) {
- j--;
- }
- for (; j>=0 ; j--) {
- System.out.print ( Resultado[j] );
- }
- System.out.println (" " );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement