Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int a[50], n, i;
- printf("Enter the Decimal number: ");
- scanf("%d", &n);
- for (i = 0; n > 0; i++) {
- a[i] = n % 2;
- n = n / 2;
- }
- printf("Binary= ");
- for (i = i - 1; i >= 0; i--)
- printf("%d", a[i]);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment