1#include <stdio.h>
2#include <math.h>
3#include <stdlib.h>
4
5#define D 10
6
7int main()
8{
9 int i, n, k, vet[D];
10
11 printf("FROM DECIMALS TO BINARIES\nEnter decimal: ");
12 scanf("%d", &n);
13
14 k = 0;
15
16 while (n != 0)
17 {
18 if ((n % 2) == 1)
19 vet[k] = 1;
20 else
21 vet[k] = 0;
22
23 n /= 2;
24
25 k++;
26 }
27
28 printf("Transformed into binary: ");
29
30 for(i = k - 1; i >= 0; i --)
31 printf("%d", vet[i]);
32
33 printf("\n\n");
34
35 system("pause");
36}