Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //20_10_17
- //Crehul Vlad
- //Base conversion: Decimal into Binary
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- void main() {
- int k=0, i, r, nr, c, N[64];
- printf("Decimal Nr: "); scanf("%d", &nr);
- c = nr;
- while (nr % 2 != 0) {
- r = c % 2;
- c = c / 2;
- N[k] = r; k++;
- }
- for (i = k; i > 0; i--) {
- printf("%d ", N[i]);
- }
- _getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment