1: #include <stdio.h>
2: int main()
3: {
4: int n, c, k;
5: printf("Enter an integer in decimal number system\n");
6: scanf("%d", &n);
7: printf("%d in binary number system is:\n", n);
8: for (c = 31; c >= 0; c--)
9: {
10: k = n >> c;
11: if (k & 1)
12: printf("1");
13: else
14: printf("0");
15: }
16: printf("\n");
17: return 0;
18: }
getsprogramming Tutorials , C Programming, CPP Programming and JAVA Programming , Python Programming , Javascript Programming Welcome to getsprogramming Blog Here You Find Different Programs in Easier way to Explain and gain Knowledge and Try Your Self..Thanks
Friday, 10 July 2015
Write C program to Decimal to Binary Conversion
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment