How to convert Decimal to Binary using C#?
Answers
Answered by
0
Answer:
C program to convert decimal to binary
#include <stdio.h>
int main()
{
int n, c, k;
printf("Enter an integer in decimal number system\n");
scanf("%d", &n);
printf("%d in binary number system is:\n", n);
for (c = 31; c >= 0; c--)
{
k = n >> c;
if (k & 1)
printf("1");
else
printf("0");
}
printf("\n");
return 0;
}
Explanation:
Similar questions
Art,
6 months ago
Accountancy,
6 months ago
English,
6 months ago
Math,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago