Compare commits

..

No commits in common. '964cfa4beb0cf93446436f7e2a5df37ffe22f500' and '5af67a084943b20be2baa645c473fd36401b4216' have entirely different histories.

@ -1,13 +1,13 @@
class jinzhi_lj { class jinzhi_lj {
public static void main(String[] args) { public static void main(String[] args) {
int n = 15; int a = 15;
int x=0; int n = 0;
int i=0; int i=0;
while (n > 0) { while (a > 0) {
x = (int) (x + (n % 2) * Math.pow(10,i)); n = (int) (n + (a % 2) * Math.pow(10,i));
n = n / 2; a = a / 2;
i=i+1; i=i+1;
} }
System.out.print("十进制n转换二进制a为" + x); System.out.print("十进制a转换二进制n为" + n);
} }
} }
Loading…
Cancel
Save