Advertisement
aiNayan

7(viii)

Dec 7th, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. int deci_to_bin(int n)
  3. {
  4. if (n == 0)
  5. return 0;
  6. else
  7. return ((n % 2) + 10 * deci_to_bin(n / 2));
  8. }
  9. void main()
  10. {
  11. int num;
  12.  
  13. printf("Enter the number: ");
  14. scanf("%d", &num);
  15. printf("%d = %d", num, deci_to_bin(num));
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement