(Cprogramming)I'm going to make a code decimal number to binary number

#include<stdio.h>
int main(void)
{
int input = 0;//input will be a number which I type.
int i = 0;
int namuji[20];//namuji is for last number after divide with 2.
scanf_s("%d", input);
do
{
namuji[i] = input / 2;
input = input % 2;
i++;
} while (input == 1);
for (i=i; i > 0; i–)
{
printf("%d", namuji[i]);
}
return 0;
}
But I can’t run this code. is there is any problem? can you give me advice

What exactly do you mean by “can’t run”? What exactly happens (including any commands you’re using and their output)?

Also, please enclose any code with triple backticks (```). That makes it a markdown code block, which preserves indentation and uses a fixed width font. Code is much easier to read that way.

int main()
{
    printf("Hello World!\n");
}

thank you, Now I solved that problem,and It was just my notebook’s problem that made enable to run this code. There was just some error including trash value in parameter.

1 Like