---
# System prepended metadata

title: 13587 - To Binary (II)
tags: [I2P(I)Hu2022]

---

###### tags: `I2P(I)Hu2022`
# 13587 - To Binary (II) 

> by schdoel

## Brief
Turn a decimal into binary.

## Solution

Convert the decimal into binary. XD


## Reference Code
```cpp=
#include<stdio.h>

int main(void){
    int n, idx = 0, res[35];
    scanf("%d", &n);
    if (n) {
        while (n) {
            res[idx++] = n % 2;
            n/=2;
        }
        while (idx--) printf("%d", res[idx]);
        printf("\n");
    }
    else printf("0\n");
    return 0;
}
```

