#include <stdio.h>
int
printnum(unsigned int x)
{
int rc;
if (x < 1000)
return (printf("%u", x));
rc = printnum(x / 1000);
if (rc < 0)
return (-1);
if (printf(",%03u", x % 1000) < 0)
return (-1);
return (rc + 4);
}
-
-
-
Completely untested, but it should get the return code correct. If you want to handle signed ints, that's a simple wrapper around this.
- 1 more reply
New conversation -
-
-
# Python 3 print(format(1234567890, ",d"))
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
package main import ( "os" "strconv" "http://golang.org/x/text/language " "http://golang.org/x/text/message " ) func main() { p := message.NewPrinter(language.English) i, _ := strconv.Atoi(os.Args[1]) p.Printf("%d\n", i) }
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
=TEXT(A1,"#,###")
-
Best tweet in 2019 so far! (not just because this would have been my answer)pic.twitter.com/nTFWQIiCu0
End of conversation
New conversation -
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
That is an invalid number as the decimal separator is used 3 times. So no. :-)
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
const num = 1234567890; console.log(num.toLocaleString());
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
LC_NUMERIC=en_US printf "%'.f\n" 1234567890;
#bashThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.