/*
Code integrity, and friends can go to their own copy machine to run
ideas:
1, octal open
2, find each binary digit, and the presence of the array from the back
3, print two-dimensional array
* /
#include<stdio.h>
#include<math.h>
#include<string.h>
void tobin(int present,int bit,int arr[10][3]){
int j = 2;
while(present){
if(present%2)
arr[bit][j] = present%2;//如果是1,则修改数组
present/=2;
j--;
}
}
void show(int arr[10][3],int bit){
for(int i = bit-1; i >=0; i-- ){
for(int j = 0; j < 3; j++)
printf("%d",arr[i][j]);
}//外for
printf("\n");
}
int main(){
/*
思路:
1、八进制书拆开
2、对每一位数求二进制,并从后往前存在数组里
3、打印二维数组
*/
void tobin(int prensent,int bit,int arr [10][3]);
void show(int arr[10][3],int bit);
int a,arr[10][3] = {0},present,bit = 0;
scanf("%d",&a);
//拆
while(a){
present = a%10;
tobin(present,bit,arr);
bit++;//记录几位
a/=10;
}
// printf("bit====%d\n",bit);
show(arr,bit);
return 0;
}