What is the output of the following code? [code] #include<stdio.h> void dec_to_bin(int n) { int arr[31],len = 0,i; if(n == 0)

What is the output of the following code?
Code:
#include<stdio.h>
void dec_to_bin(int n)
{
    int arr[31],len = 0,i;
    if(n == 0)
    {
        arr[0] = 0;
        len = 1;
    }
    while(n != 0)
    {
        arr[len++] = n % 2;
        n /= 2;
    }
    for(i=len-1; i>=0; i--)
        printf("%d",arr[i]);
}
int main()
{
    int n = 63;
    dec_to_bin(n);
    return 0;
}
A. 111111
B. 111011
C. 101101
D. 101010
 

Tìm kiếm

Back
Top