Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int deci_to_bin(int n)
- {
- if (n == 0)
- return 0;
- else
- return ((n % 2) + 10 * deci_to_bin(n / 2));
- }
- void main()
- {
- int num;
- printf("Enter the number: ");
- scanf("%d", &num);
- printf("%d = %d", num, deci_to_bin(num));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement