Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sizeof human
//gcc 5.4.0 //Nwutobo Ugochukwu Samuel //sammycageagle@gmail.com //21/11/2018 //sizeof human #include <stdio.h> void sizeof_human(float n, char *buf){ char *units[] = {"B","kB","MB","GB"}; int len = sizeof(units)/sizeof(*units); int i; for (i = 0; i < len-1; i++){ if (n < 1024.0){ sprintf(buf, "%.1f %s", n, units[i]); return; } n /= 1024; } sprintf(buf, "%.1f %s", n, units[i]); } int main(void) { float i = 5000000000; char buf[256]; sizeof_human(i, buf); printf("%s", buf); return 0; }
run
|
edit
|
history
|
help
0
3-D array sum and search
150112_CribaErastotenes
sample.c
A_141124Burbuja
BSEARCH() COMPLETE
A_141205_CADENAS
problem5 review fundamentos
B_141121_factorial02
1
Divisibility :- #simple-math #ad-hoc-1 #basics