Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
WAP in C to convert decimal to binary
//gcc 5.4.0 #include <stdio.h> int main(void) { long num, dv= 6, rem, n=0, base=1, bv=0; num = dv ; while (num > 0) { rem = num % 2; if (rem == 1 ) { n++; } bv = bv + rem * base; num = num / 2; base = base*10; } printf ("%ld",bv); }
run
|
edit
|
history
|
help
1
tgo
1.8 Parallizing for loop
mod 4
Static scope
sreesasu
B_141121_aleatorios
C_141113_Primos02
A.c
Timestamp microsecond for C
A_141211_Tartaglia