class biner
{
public static void main (String [] args)
{
String bilangan;
int[] sisa = new int[100];
bilangan = JOptionPane.showInputDialog("inputkan N : ");
int N;
N = Integer.parseInt(bilangan);
int I,jum;
I=1;
while (N>1)
{
sisa[I] = N%2;
N = N/2;
I++;
}
sisa[I]=N;
System.out.println();
jum = I;
for (I=jum;I>=1;I--)
{
System.out.print(sisa[I]);
}
}
}
Tidak ada komentar:
Posting Komentar