aiNayan

5(vi)

Nov 28th, 2020
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. int main()
  3. {
  4. int a[50], n, i;
  5. printf("Enter the Decimal number: ");
  6. scanf("%d", &n);
  7. for (i = 0; n > 0; i++) {
  8. a[i] = n % 2;
  9. n = n / 2;
  10. }
  11. printf("Binary= ");
  12. for (i = i - 1; i >= 0; i--)
  13. printf("%d", a[i]);
  14. return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment