You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
280 B

#include<bits/stdc++.h>
using namespace std;
int main() {
int i,s,k;
int a[5]= {0};
for(i=0; i<32; i++) {
s=i;
k=0;
//转为2进制数组
while(s) {
a[k]=s%2;
s=s/2;
k++;
}
//输出吧
for(k=4; k>=0; k--)
printf("%d",a[k]);
printf("\n");
}
return 0;
}