MIPI_BaseC_WebinarFRTK/07_Lecture07/14_dec_to_bin_p38.c

22 lines
346 B
C
Raw Normal View History

2024-11-13 09:22:28 +03:00
#include <stdio.h>
void dec_to_bin(int n)
{
if (n >= 2)
dec_to_bin(n / 2);
printf("%d", n % 2);
//std::cout << n % 2;
}
int main()
{
int n;
printf("n -> ");
//std::cout << "\n\nn -> ";
scanf("%d",&n);
//std::cin >> n;
printf("Bin = ");
//std::cout << "\n\nBin = ";
dec_to_bin(n);
return 0;
}